Razor Storm
Razor Storm

Reputation: 12336

Setting alpha for text color for Button

I tried setting textColor to have alpha, but it doesn't seem to work.

<Button
    android:id="@+id/multi_player"
    android:text="@string/multi_player"
    android:textColor="#AAFFFFFF" />

No matter what alpha level I give it, the text still shows up as fully opaque white.

Upvotes: 2

Views: 5140

Answers (1)

Cat
Cat

Reputation: 67522

This appears to be an issue on (some versions of) Android, where alpha is not considered when set using #rgb or #argb formats.

Instead, move it to a resource file:

<color name="blah">#aaffffff</color>

Then, call it using:

android:textColor="@color/blah"

Upvotes: 6

Related Questions