Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android EditText中的滚动功能未按要求工作_Android - Fatal编程技术网

Android EditText中的滚动功能未按要求工作

Android EditText中的滚动功能未按要求工作,android,Android,我有一个活动,其中包含一个具有静态高度的EditText,因此当写入长文本时,用户必须通过平移滚动才能看到完整的文本。但是,当存在虚拟键盘时,用户无法滚动到上面和/或下面的行 我已经搜索了这个问题,但找不到任何解决方案。关于如何定制XML(如下所示)以让用户能够滚动和查看整个文本,有什么建议吗 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientatio

我有一个活动,其中包含一个具有静态高度的EditText,因此当写入长文本时,用户必须通过平移滚动才能看到完整的文本。但是,当存在虚拟键盘时,用户无法滚动到上面和/或下面的行

我已经搜索了这个问题,但找不到任何解决方案。关于如何定制XML(如下所示)以让用户能够滚动和查看整个文本,有什么建议吗

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1"/>
</LinearLayout>

希望这对您有所帮助

<EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textMultiLine" 
        android:scrollbars="vertical"
       <!-- This is for test purpose only -->  android:maxLines="3">
    </EditText>
android:maxLines=“3”

我也遇到了同样的问题


通过向您的
EditText

添加属性来修复此问题。由于应用程序的设计限制,高度需要静态设置,而不是包装内容……将maxLines设置为较低的数字可能会节省我的时间,但同样,由于外观原因,此设置不合适。