EditText实现自动换行,自动增高,上下滚动

本文是做聊天室时,实现微信发信息的文本框即标题所述。
代码如下

<EditText
android:id="@+id/et_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_weight="1"
android:background="@drawable/et_input_shape"
android:gravity="center_vertical"
//多行文本
android:inputType="textMultiLine"
//显示4行
android:lines="4"
//最少1行,一开始是1行的高度
android:minLines="1"
android:padding="3dp"
android:textCursorDrawable="@null"
/>

主要代码是上面加注释的三行代码,应该都能看的懂
实现效果如下
EditText实现自动换行,自动增高,上下滚动

相关文章:

  • 2021-12-16
  • 2021-10-25
  • 2021-06-10
  • 2021-10-26
  • 2022-12-23
  • 2021-11-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-03
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
相关资源
相似解决方案