Wednesday, 14 June 2017

How to change Button color in Android


It is very easy to change the Button color in android with just one line of code.

Open New Android Application project and drag and drop the button in the UI interface .



Then double click on the button it will take you to the activity_main.xml in which you can see the button coding


In that add the following code

 android:background="any html color code"


After typing the code save it and click the Graphical Layout to see the change of the button color.


You can get the HTML color code in the internet.

It ranges from 0-9 and A-F , combination of these 6 digits will make a color.

Also Read:

Working with Buttons