Android EditText支持imeOptions且多行显

2023-10-09  本文已影响0人  Android出海

android EditText 单行显示并且设置imeOptions很简单,条件是在xml中将singleLine设置为true,但是文本框需要多行时,imeOptions默认会无效。

解决方案

xml设置

android:imeOptions="actionDone"
android:inputType="text"

代码设置

editText.setHorizontallyScrolling(false)
editText.maxLines = Integer.MAX_VALUE
上一篇 下一篇

猜你喜欢

热点阅读