Change button above text color android using XML

Customize button styles to choose Photoshop colors on android button text.

Button above text color is changeable through its own android:textColor=” ”¬†attribute . So just use this attribute in button tag and define your color with #( hash)¬†combination in double course. So here is the complete step by step tutorial for Change button above text color in android using XML .

android-project-download-code-button

How to Change button above text color in android using XML .

Code for MainActivity.java file.

package com.android_examples.com.buttontextcolor;
import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }
}

Code for activity_main.xml layout file.

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:paddingBottom="@dimen/activity_vertical_margin"
 android:paddingLeft="@dimen/activity_horizontal_margin"
 android:paddingRight="@dimen/activity_horizontal_margin"
 android:paddingTop="@dimen/activity_vertical_margin"
 tools:context="com.android_examples.com.buttontextcolor.MainActivity" >

 <Button
 android:id="@+id/button1"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_centerHorizontal="true"
 android:layout_centerVertical="true"
 android:text="Button text color change using xml"
 android:textColor="#fb0404" />

</RelativeLayout>

Screenshot:

Change button above text color in android using XML

Click Here to Download Change button above text color in android using XML project.

Leave a Reply

Your email address will not be published. Required fields are marked *