我想要一个5行高的EditText视图。我希望它有五行高,只是为了视觉上的吸引力(这样它就不会显得拥挤)。下面的代码不工作,EditText只显示一行高。
我尝试过multilinetext,它在视觉上工作,但是我想放弃它,因为我希望虚拟键盘上写着"Next“(而不是自动提供带有多行文本的enter键)。
我怎样才能使我的EditText盒更大?或者,如何在多行文本中使用imeOption "actionNext“?
这段代码不工作.
<EditText
android:id="@+id/etEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="text"
android:lines="5" //this has no effect!
android:imeOptions="actionNext"
style="@style/dialogInput" />
发布于 2014-05-01 06:48:14
更改:
android:inputType="text"
至:
android:inputType="textMultiLine"
为我工作!
发布于 2011-10-03 03:52:42
<EditText
android:id="@+id/etEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:inputType="text"
android:lines="5" //this has no effect!
android:imeOptions="actionNext"
style="@style/dialogInput"
android:singleLine="false" />
android:singleLine="false" will make editText to support multiple lines
发布于 2011-10-03 05:02:21
另一方面,您可以尝试使用文本字符串上的换行来显示,这是技巧:http://xjaphx.wordpress.com/2011/07/15/set-line-break-in-textview/。
当然,你必须设置:
android:singleLine="false"
https://stackoverflow.com/questions/7630803
复制相似问题