gpt4 book ai didi

android - 是否可以在 TextInputLayout 提示中使用 html 标签或 spannable?

转载 作者:行者123 更新时间:2023-11-29 16:51:05 25 4
gpt4 key购买 nike

我的布局中有一个 TextInputLayout,我想在它的提示中使用 html 标记或 spannable,但它无法使用它。

我在谷歌中搜索了所有链接,但结果是“现在不可能,也许在下一个版本中可能会更新”。

是否可以自定义 TextInputLayout View 以在提示中接受 html 标记?我该怎么做?

最佳答案

在 TextInputLayout 的布局 xml 文件中添加以下代码:

<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_horizontal_margin"
app:hintAnimationEnabled="false">

<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/enter_message" />

</android.support.design.widget.TextInputLayout>

在string.xml文件中添加如下代码:

<string name="enter_message">Enter Message<font fgcolor="red">*</font></string>

关于android - 是否可以在 TextInputLayout 提示中使用 html 标签或 spannable?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46418957/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com