繁体   English   中英

使文本适合EditText Android

[英]Fit text into an EditText Android

我正在使用EditText通过editText.setText(string)放置特定文本,我试图将EditText的高度与String的行匹配,但是我不能。

如果我使用EditText并正常书写,则效果很好,但是我需要使用setText()放置文本。

有人能帮我吗?

例

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="false"
                android:id="@+id/text_description"
                android:maxLength="500"
                android:focusableInTouchMode="false"
                android:layout_weight="0" />

在您的XML文件中,将android:layout_height属性设置为wrap_content如下所示:

<EditText
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   ...../>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM