多行 EditText 聚焦时缩小

发布于 2024-12-27 13:06:42 字数 634 浏览 3 评论 0原文

我有一个多链接邮政地址 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.Pictured Below

How can I stop this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

窝囊感情。 2025-01-03 13:06:42

尝试删除 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.

深空失忆 2025-01-03 13:06:42

这是因为该小部件继承了单行 edittext 的属性

This was because the widget was inheriting properties from a single-line edittext

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文