
<com.example.viveka.snipeID.CustomTextinputLayout androID:ID="@+ID/input_layout_name" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_margintop="15dp" app:errorEnabled="true" > <EditText androID:ID="@+ID/editEmail" androID:layout_wIDth="match_parent" androID:layout_height="40dp" androID:hint="email / snipe ID" androID:digits="abcdefghijklmnopqrstuvwxyz.@0123456789" androID:textAllCaps="false" androID:textSize="12sp" androID:layout_marginleft="-4dp" androID:textcolor="@color/lightgray" androID:textcolorHint="@color/primary"/> </com.example.viveka.snipeID.CustomTextinputLayout>
预期图像
我得到了什么
我需要将两个字段更改为相同的颜色..
解决方法 你可以这样做.androID:textcolorHint =“#FF0000”是EditText的提示颜色.
如果您想要文本颜色以及提示颜色.
您可以在EditText中更改androID:textcolor =“#FF0000”.
您可以添加app:errorTextAppearance =“@ style / text_in_layout_error_hint_Style”来更改错误文本颜色.
<com.example.viveka.snipeID.CustomTextinputLayout androID:ID="@+ID/input_layout_name" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_margintop="15dp" androID:textcolorHint="#FF0000" app:errorTextAppearance="@style/text_in_layout_error_hint_Style" app:hintTextAppearance="@style/text_in_layout_hint_Style" app:errorEnabled="true"> <EditText androID:ID="@+ID/editEmail" androID:layout_wIDth="match_parent" androID:layout_height="40dp" androID:layout_marginleft="-4dp" androID:digits="abcdefghijklmnopqrstuvwxyz.@0123456789" androID:hint="email / snipe ID" androID:textAllCaps="false" androID:textcolor="#FF0000" androID:textcolorHint="@color/primary" androID:textSize="12sp"/></com.example.viveka.snipeID.CustomTextinputLayout>
left-top提示颜色取决于app:hintTextAppearance =“@ style / text_in_layout_hint_Style”.
和样式代码:
<style name="text_in_layout_hint_Style"> <item name="androID:textcolor">#FF0000</item> <item name="androID:textSize">12sp</item></style>
添加错误文本样式
<style name="text_in_layout_error_hint_Style"> <item name="androID:textcolor">#00ff00</item> <item name="androID:textSize">12sp</item></style>
像这样:
以上是内存溢出为你收集整理的android – 以编程方式更改TextInputLayout聚焦和未聚焦的提示颜色全部内容,希望文章能够帮你解决android – 以编程方式更改TextInputLayout聚焦和未聚焦的提示颜色所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)