多行 EditText 聚焦时缩小
我有一个多链接邮政地址 EditText 小部件,其声明如下:
<EditText
android:id="@+id/pat_address_input"
android:layout_width="250dp"
android:layout_height="100dp"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:height="100dp"
android:inputType="textPostalAddress"
android:lines="5"
android:textColor="@color/white"
android:textSize="10pt" >
</EditText>
在我的代码中,我将 focus 属性设置为 true 并将 focusontouch 设置为 true,但是当 EditText 小部件聚焦时,EditText 缩小为单行框并且光标挂在小部件下方。
我怎样才能阻止这个?
I have a multi-link postal address EditText widget which is declared as below:
<EditText
android:id="@+id/pat_address_input"
android:layout_width="250dp"
android:layout_height="100dp"
android:background="@null"
android:clickable="false"
android:focusable="false"
android:height="100dp"
android:inputType="textPostalAddress"
android:lines="5"
android:textColor="@color/white"
android:textSize="10pt" >
</EditText>
In my code, I set the focus property to true and focusontouch to true, however when the EditText widget it focused the EditText shrinks to a single line box and the cursor hangs underneath the widget.
How can I stop this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试删除
android:lines="5"
,这一切对我来说都没有问题。我也很困惑为什么当你的字段背景是白色时你的文本是白色的。
Try removing the
android:lines="5"
, this all worked for me with no issues.I am also confused as to why your text is white when your background of the field is white.
这是因为该小部件继承了单行 edittext 的属性
This was because the widget was inheriting properties from a single-line edittext