RiT*_*hBo 9 android newline android-edittext
我对EditText有一个(?简单?)问题.每当我输入它时,即使我到达屏幕边缘而不是创建新行,文本也会保持在同一行.我确定我以前记得它默认这样做,但我似乎无法让它工作知道...
<EditText
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/hint"
android:inputType="textCapSentences" />
Run Code Online (Sandbox Code Playgroud)
编辑:问题是因为有一个android:inputType.有没有办法让输入类型有多行?
Pla*_*eon 31
您可以通过使用管道"|"分隔标志来在输入类型上设置多个属性 字符.尝试以下设置:
android:inputType="textCapSentences|textMultiLine"
Run Code Online (Sandbox Code Playgroud)
完整代码:
<EditText
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/hint"
android:lines="3"
android:inputType="textCapSentences|textMultiLine" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4401 次 |
| 最近记录: |