gpt4 book ai didi

android - 是否可以在 android 中更改提示颜色的一部分?

转载 作者:太空宇宙 更新时间:2023-11-03 13:42:41 25 4
gpt4 key购买 nike

我在 TextInputLayout 中有一个 AppCompatEditText 并设置来自字符串资源的提示。

<string name="company_name">Companyname <font fgcolor='#FF0000'>&#42;</font></string>

星星的颜色没有变成红色。

这就是我得到的。

enter image description here

我想要的(在 photoshop 中编辑)

enter image description here

我用图像尝试了 drawableEnd,但 AppCompatEditText 的宽度为“match_parent”。所以它显示在最后。我不知道那是什么。有什么办法吗?

更新:

试过这个:

company_name.setHint(Html.fromHtml("<small><i>" + "Text Hint Here" + "</i><font color=#FF0000>&#42;</font></small>"));

这就是我得到的。旧提示不会被新提示取代。两个提示都在显示。

enter image description here

最佳答案

change edittext hint color :-
android:backgroundTint="@color/colorAccent"
TextInputLayout
android:textColorHint="#707E90"
....................................................
<android.support.design.widget.TextInputLayout
android:id="@+id/txt_usemail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="#707E90">

<EditText
android:id="@+id/et_usemaill"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:backgroundTint="@color/colorAccent"
android:hint="@string/res_email"
android:inputType="textEmailAddress"
android:textColor="@color/textcolor" />

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

关于android - 是否可以在 android 中更改提示颜色的一部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48422136/

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