Android EditText控件即设置最小高度又运行高度随内容增加而变化

(转)http://www.aichengxu.com/view/1405748   记录学习用

如题,有时候EditText需要一个最小的高度,但是在输入更多内容时,要随着内容的增加而变化高度,一般都是增加。这时我们可以利用EditText的minLines属性。

即最小行数,只要我们指定了minLines属性,同时将layout_height 设置为wrap_content ,即可实现我们的目的。

 

<EditText
android:id="@id/shareadd_content"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left|top" android:hint="@string/input_share_content" android:textColor="@color/gay_33" android:minLines="3" android:background="@drawable/bg_newsdetail_edit" />
posted @ 2016-05-26 08:25  一只呆萌的萌呆  阅读(4668)  评论(0编辑  收藏  举报