0

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?

vergil corleone
  • 1,091
  • 3
  • 16
  • 34

2 Answers2

1

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.

Batuhan Coşkun
  • 2,961
  • 2
  • 31
  • 48
0

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/

user1718854
  • 446
  • 4
  • 7