Android “在滚动视图中编辑文本”不可滚动

Android “在滚动视图中编辑文本”不可滚动,android,xml,android-layout,android-edittext,scrollview,Android,Xml,Android Layout,Android Edittext,Scrollview,我一直在寻找解决方案,但似乎这些都不起作用。我的情况是否不适用于更改xml?如何解决这个问题?滚动视图工作,但编辑文本不工作。谢谢 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_he

我一直在寻找解决方案,但似乎这些都不起作用。我的情况是否不适用于更改xml?如何解决这个问题?滚动视图工作,但编辑文本不工作。谢谢

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/share_bg" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:layout_marginTop="20dp"
        android:overScrollMode="never" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <ImageView
                android:id="@+id/photo_area"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <TextView
                android:id="@+id/share_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/photo_area"
                android:layout_marginLeft="20dp"
                android:layout_marginTop="20dp"
                android:text="@string/share_title"
                android:textColor="@android:color/white" />

            <EditText
                android:id="@+id/share_content"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/share_title"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:background="@drawable/custom_textarea"
                android:gravity="top|left"
                android:lines="5"
                android:scrollbars="vertical"
                android:text="@string/default_msg" >

                <requestFocus />
            </EditText>

            <ImageView
                android:id="@+id/share_submit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/share_content"
                android:layout_centerHorizontal="true"
                android:src="@drawable/photo_taken_btn_submit" />
        </RelativeLayout>
    </ScrollView>

</RelativeLayout>


id:share\u内容是editText,谢谢您可以执行此操作以使editText可滚动:

 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;
            }
        });

请参阅“”

以澄清,它究竟是如何不起作用的?如果它不工作呢?滚动视图工作,但编辑文本不工作。当我在edittext上滚动时,它会移动滚动视图。谢谢。你检查过了吗?谢谢使用编程方式的工作检查链接。你会得到答案的。你能澄清MotionEvent.ACTION_MASK的目的吗?谢谢,这对我很有帮助。我能够将整个if块缩短为
v.getParent().requestDisallowWinterCeptTouchEvent(!((event.getAction()&MotionEvent.ACTION\u MASK)==MotionEvent.ACTION\u UP))不过,我觉得它看起来更干净。