Mis*_*rdi 3 android textcolor android-edittext
我想将提示颜色设置EditText为禁用的文本颜色.所以我使用android:textColorHint属性.但我不知道该怎么做:
android:textColorHint="@android:color/???" // what should I select?
//OR
android:textColorHint="?android:attr/???" // what should I select?
Run Code Online (Sandbox Code Playgroud)
编辑:我可以在值中定义相同的颜色,但我想引用它来处理未来的更改.
您可以在文档https://material.google.com/style/color.html#color-text-background-colors中找到答案
对于浅色背景上的深色文本,请应用以下不透明度级别:
最重要的文字的不透明度为87%.
次要文本在视觉层次结构中较低,不透明度为54%.
文本提示(如文本字段和标签中的文本提示)和禁用的文本具有更低的视觉突出度,不透明度为38%.
小智 5
您好 Misagh,您可以通过以下方式获取提示颜色:
1. final ColorStateList colors = editText.getHintTextColors();
editText.setTextColor(colors);`
Run Code Online (Sandbox Code Playgroud)
你可以通过这个文档: http : //developer.android.com/reference/android/widget/TextView.html#getHintTextColors%28%29
请让我知道,如果有任何问题。
| 归档时间: |
|
| 查看次数: |
7533 次 |
| 最近记录: |