Android Edittext测试不会在屏幕边界处停止

Android Edittext测试不会在屏幕边界处停止,android,android-layout,android-edittext,Android,Android Layout,Android Edittext,我在记事本应用程序的布局中添加了EditText。当我试着在EditText中输入文本时,我意识到如果文本字符串比屏幕边缘长,它将沿着直线继续过去,而不是向下进入下一行。布局的代码如下所示 <ScrollView android:layout_height="match_parent" android:layout_width="match_parent" android:fillViewport="true" xmlns:android="http://schemas.android.c

我在记事本应用程序的布局中添加了EditText。当我试着在EditText中输入文本时,我意识到如果文本字符串比屏幕边缘长,它将沿着直线继续过去,而不是向下进入下一行。布局的代码如下所示

<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:fillViewport="true"
xmlns:android="http://schemas.android.com/apk/res/android">

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/noteEditorLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <EditText
        android:id="@+id/noteEditor"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:hint="@string/enterText"
        android:textSize="18sp"
        android:background="#00000000"
        android:inputType="textMultiLine|textCapSentences"
        android:gravity="top"
        android:layout_weight="1">
    </EditText>
</LinearLayout>

谢谢。

尝试设置您的

android:layout\u width=“0dp”

android:layout\u width=“match\u parent”

反而

或者,如果您坚持使用
layout\u weight
属性,请将此行添加到
LinearLayout

android:weightSum="1"

如果可以的话我会的,但是StackOverflow说我需要更高的声誉来做到这一点。