vergil corleone
vergil corleone

Reputation: 1111

Button not showing color in android?

This is the XML for the button:

<Button
    android:id="@+id/login"
    android:color="#048b9dc3"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:text="@string/login"
     />

The button is the default gray color in the app instead of semi transparent blue color I've set above. What am I doing wrong?

Upvotes: 0

Views: 233

Answers (2)

user1718854
user1718854

Reputation: 446

You can either set it in XML file:-

Or set it in your java program:-

button.setBackgroundColor(Color.BLACK);

Or you can just write the 4-byte hex code (not 3-byte) 0xFF000000

http://xjaphx.wordpress.com/2011/06/10/setting-buttons-colors/

Upvotes: 0

Batuhan Coşkun
Batuhan Coşkun

Reputation: 2969

You should set background instead of color. Add this block :

android:background="YOUR_COLOR_CODE_HERE"

Also your color code is not proper. You can use photoshop for finding color code which you want.

Upvotes: 1

Related Questions