edittext中禁用文本的android默认颜色是什么?

时间:2014-11-16 07:14:37

标签: android android-edittext textcolor

我想将EditText中的提示颜色设置为禁用的文本颜色。所以我使用android:textColorHint属性。但我不知道该怎么做:

android:textColorHint="@android:color/???"     // what should I select?
//OR
android:textColorHint="?android:attr/???"      // what should I select?

编辑:我可以在值中定义相同的颜色,但我想引用它来处理将来的更改。

2 个答案:

答案 0 :(得分:6)

您可以在文档中找到答案 https://material.google.com/style/color.html#color-text-background-colors

  

对于浅色背景上的深色文本,请应用以下不透明度   级别:

     

最重要的文字的不透明度为87%。
中学文字,   视觉层次较低,不透明度为54%   文本提示(如文本字段和标签中的提示)和禁用的文本   具有更低的视觉突出度,不透明度为38%。

答案 1 :(得分:4)

您好Misagh,您可以通过以下方式获取提示颜色:

 1. final ColorStateList colors = editText.getHintTextColors();
     editText.setTextColor(colors);`
  1. 颜色代码为:#808080(R-128,G-128,B-128)
  2. 您可以浏览此文档: http://developer.android.com/reference/android/widget/TextView.html#getHintTextColors%28%29

    如果有任何问题,请告诉我。