3

각 레이아웃에서 ScrollView가 포함 된 ViewFlipper에는 두 개의 레이아웃이 있습니다. 그러나, 내 EditText 작동하지 않으며 그 이유는 ScrollView 인해 알 것입니다. 그러나, 나는 대답을 Disable ScrollView action에 시도했지만 아무도 나를 위해 일하지 않았다. 내 XML에 문제가 있습니까? 내 XML은 다음과 같은 표시됩니다 :ScrollView 및 ViewFlipper 내에서 스크롤 가능한 EditText 사용

PageFlipper

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#FFF" 
android:id="@+id/flipperlayout" 
android:orientation="vertical"> 

<!-- Header --> 

<include 
    android:id="@+id/include1" 
    layout="@layout/prepostheader" /> 

    <RelativeLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="#FFF" 
    android:orientation="vertical"> 

<Button 
    android:id="@+id/btnPage2" 
    style="@style/PageBtnFont" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_below="@+id/include1" 
    android:layout_marginTop="2dp" 
    android:layout_marginRight="5dp" 
    android:background="@drawable/button" 
    android:text="Page 2" /> 

<Button 
    android:id="@+id/btnPage1" 
    style="@style/PageBtnFont" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignBaseline="@+id/btnPage2" 
    android:layout_alignBottom="@+id/btnPage2" 
    android:layout_toLeftOf="@+id/btnPage2" 
    android:layout_marginRight="5dp" 
    android:background="@drawable/button" 
    android:text="Page 1" /> 
</RelativeLayout> 


<ViewFlipper 
    android:id="@+id/flipper" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">   


    <include layout="@layout/prepostform" 
     android:adjustViewBounds="true"/> 
    <include layout="@layout/prepostform2" 
     android:adjustViewBounds="true"/> 

</ViewFlipper> 

페이지 1

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/editFormLayout" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#FFF" 
android:orientation="vertical" > 

<ScrollView 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/scrollView" 
    android:layout_weight="1" 
    android:padding="5px"> 

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:adjustViewBounds="true" 
    android:src="@drawable/formprepost" /> 



<EditText 
    android:id="@+id/name" 
    android:layout_width="400dp" 
    android:layout_height="35dp" 
    android:layout_alignParentRight="true" 
    android:layout_below="@+id/include1" 
    android:layout_marginRight="90dp" 
    android:layout_marginTop="134dp" 
    android:background="#0000" 
    android:ellipsize="start" 
    android:inputType="textCapWords|textPersonName" 
    android:lines="1" 
    android:maxLines="1" 
    android:textAppearance="@style/TextStyle1" > 

</EditText> 

<EditText 
    android:id="@+id/school" 
    android:layout_width="400dp" 
    android:layout_height="35dp" 
    android:layout_marginTop="-8dp" 
    android:layout_alignLeft="@+id/name" 
    android:inputType="textCapWords|textPersonName" 
    android:background="#0000" 
    android:textAppearance="@style/TextStyle1" 
    android:ellipsize="start" 
    android:maxLines = "1" 
    android:lines = "1" 
    android:layout_below="@+id/name" /> 

<EditText 
    android:id="@+id/supervisor" 
    android:layout_width="400dp" 
    android:layout_height="35dp" 
    android:layout_marginTop="-9dp" 
    android:layout_alignLeft="@+id/school" 
    android:inputType="textCapWords|textPersonName" 
    android:background="#0000" 
    android:textAppearance="@style/TextStyle1" 
    android:ellipsize="start" 
    android:maxLines = "1" 
    android:lines = "1" 
    android:layout_below="@+id/school" /> 

<EditText 
    android:id="@+id/date" 
    android:layout_width="200dp" 
    android:layout_height="35dp" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/supervisor" 
    android:layout_marginLeft="185dp" 
    android:inputType="textCapWords|textPersonName" 
    android:textAppearance="@style/TextStyle1" 
    android:background="#0000" 
    android:ellipsize="start" 
    android:maxLines="1" 
    android:layout_marginTop="116dp"> 
</EditText> 

<CheckBox 
    android:id="@+id/tick1" 
    android:layout_width="540dp" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:button="@drawable/checkbox_selector" 
    android:layout_below="@+id/date" 
    android:layout_marginLeft="154dp" 
    android:layout_marginTop="43dp"/> 

<CheckBox 
    android:id="@+id/tick2" 
    android:layout_width="240dp" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="-11dp" 
    android:layout_alignLeft="@+id/tick1" 
    android:button="@drawable/checkbox_selector" 
    android:layout_below="@+id/tick1"/> 

<CheckBox 
    android:id="@+id/tick3" 
    android:layout_width="270dp" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/tick2" 
    android:layout_marginTop="-12dp" 
    android:button="@drawable/checkbox_selector" 
    android:layout_below="@+id/tick2" /> 




<EditText 
    android:id="@+id/comment1" 
    android:layout_width="614dp" 
    android:layout_height="180dp" 
    android:layout_alignParentLeft="true" 
    android:layout_alignRight="@+id/tick1" 
    android:layout_below="@+id/tick3" 
    android:layout_marginLeft="94dp" 
    android:layout_marginTop="23dp" 
    android:gravity="top|left" 
    android:inputType="textCapSentences|textMultiLine" 
    android:textAppearance="@style/TextStyle1" > 

</EditText> 

<EditText 
    android:id="@+id/comment2" 
    android:layout_width="614dp" 
    android:layout_height="165dp" 
    android:layout_alignLeft="@+id/comment1" 
    android:layout_alignRight="@+id/comment1" 
    android:layout_below="@+id/comment1" 
    android:layout_marginTop="90dp" 
    android:gravity="top|left" 
    android:inputType="textCapSentences|textMultiLine" /> 

<ImageButton 
    android:id="@+id/signature1" 
    android:layout_width="170dp" 
    android:layout_height="50dp" 
    android:layout_alignLeft="@+id/date" 
    android:layout_below="@+id/comment1" 
    android:layout_marginLeft="49dp" 
    android:background="#0000"/> 

<ImageButton 
    android:id="@+id/signature2" 
    android:layout_width="170dp" 
    android:layout_height="50dp" 
    android:layout_alignLeft="@+id/supervisor" 
    android:layout_below="@+id/comment2" 
    android:background="#0000" /> 
에게

답변

18

홈페이지 Actvity 클래스 :

이 아래의 방법을 수행하고 또한 너무 많은이 link

EditText EtOne = (EditText) findViewById(R.id.comment1); 
    EtOne.setOnTouchListener(new OnTouchListener() { 
       @Override 
       public boolean onTouch(View v, MotionEvent event) { 
        if (v.getId() == R.id.comment1) { 
         v.getParent().requestDisallowInterceptTouchEvent(true); 
         switch (event.getAction() & MotionEvent.ACTION_MASK) { 
         case MotionEvent.ACTION_UP: 
          v.getParent().requestDisallowInterceptTouchEvent(false); 
          break; 
         } 
        } 
        return false; 
       } 
      }); 
+0

와우 덕분에 볼 수 있습니다! 그것은 작동! – Annabel

관련 문제