Wednesday, 14 June 2017

How to change Button color in Android

How-to-change-Button-color-in-Android-gif



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 .

button




button-color-in-android

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

button-color-in-android

In that add the following code

 android:background="any html color code"


button-color-in-android

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

button-color-in-android

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 

No comments :

Post a Comment