What's the Color code for Android Hint?

24,765

Solution 1

R: 128 
G: 128 
B: 128

or

#808080

Solution 2

in your xml use this:

    android:textColor="?android:textColorHint"

Solution 3

try #a8a8a8 :)

Create a color.xml file in the res/value folder

Then define it like that:

<?xml version="1.0" encoding="utf-8"?>
<resources>
 <color name="gray">#a8a8a8</color>
</resources>

Then use it like that:

android.graphics.Color.gray;

Solution 4

For getting hint color you can use getCurrentHintTextColor(). Then you need to transform int to hex format. For example:

EditText et = (EditText) findViewById(R.id.edit_text);
        int c = et.getCurrentHintTextColor();
        Log.d("Hint color", String.format("%X", c));

Solution 5

in sources, holo theme :

<color name="hint_foreground_holo_light">#808080</color>
<color name="hint_foreground_holo_dark">#808080</color>

Material theme:

<color name="foreground_material_dark">@android:color/white</color>
<item format="float" name="hint_alpha_material_dark" type="dimen">0.50</item>

<color name="foreground_material_light">@android:color/black</color>      
<item format="float" name="hint_alpha_material_light" type="dimen">0.38</item>

so for light theme you can use #61000000 //black 38%

and for dark theme #80ffffff //white 50%

Share:
24,765

Related videos on Youtube

Paramone
Author by

Paramone

Programming enthusiast

Updated on March 30, 2021

Comments

  • Paramone
    Paramone about 3 years

    What's the Color code that Android:hint uses? By that I mean the grayish color.

    • M D
      M D about 10 years
      What are you talk in about? What is your question?
    • kai
      kai about 10 years
      i think he want to know the exact color as an rgb hex string.
    • Paramone
      Paramone about 10 years
      @Kai Yes, The exact hex code that the hint is "made of".
    • kabuto178
      kabuto178 about 10 years
      The exact color hex that stock android uses
    • donfuxx
      donfuxx about 10 years
  • Mark Buikema
    Mark Buikema about 10 years
    Don't call it grey. Give it a name that represents the application of the color. Call it "hintColor" or something.
  • Gem
    Gem about 8 years
    The color which @lapadets provide is better matching the hint on my nexus 7, Android 5.1
  • Abhimanyu
    Abhimanyu over 4 years
    #9E9E9E seems to be better matching in my device. #808080 is too dark, whereas #A8A8A8 is a bit lighter than the default hint color. The best option would be to use @Pomanh 's solution if the colour should match accurately.
  • DIRTY DAVE
    DIRTY DAVE over 2 years
    #808080 was too dark, this is perfect