大佬教程收集整理的这篇文章主要介绍了如何使Android EditText在完整时垂直展开,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<EditText android:layout_width="match_parent" android:layout_height="72dp" android:hint="@String/write_message" android:textColorHint="@color/priMary_color" android:ems="10" android:imeOptions="actionDone" android:inputType="textImeMultiLine" android:id="@+id/message_input" android:layout_gravity="center_horizontal" android:BACkgroundTint="@color/priMary_color"/>
当框中填满用户输入的文本时,它向右滚动以腾出更多文本的空间,我不喜欢这种行为,如果EditText框在需要更多空间时向上展开,它会更喜欢它吗?有没有办法做到这一点?谢谢.
>使EditText接受多行输入.
>随着更多文本行的添加,其高度会增加.
因此,要实现这一点,您需要设置:
android:inputType="textMultiLine" android:layout_height="wrap_content"
(注意difference between textMultiLine
and textImeMultiLine
).
完整的XML代码段将是:
<EditText android:layout_width="match_parent" android:inputType="textMultiLine" android:layout_height="wrap_content" android:hint="@String/write_message" android:textColorHint="@color/priMary_color" android:ems="10" android:imeOptions="actionDone" android:id="@+id/message_input" android:layout_gravity="center_horizontal" android:BACkgroundTint="@color/priMary_color"/>
以上是大佬教程为你收集整理的如何使Android EditText在完整时垂直展开全部内容,希望文章能够帮你解决如何使Android EditText在完整时垂直展开所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。