I want to change the text colour of radio button. I have tried but its not change of the text colour.How to change the text colour of radio button.Can some one give me idea how to change the colour . Thanks to appreciate.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:padding="5dp" >
<ImageView
android:id="@+id/logoKartavya"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/desc"
android:src="@drawable/logo" />
<TableLayout
android:id="@+id/quizLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/logoKartavya" >
<TextView
android:id="@+id/questionTopic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:clickable="false"
android:gravity="center"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="normal|bold" />
<EditText
android:id="@+id/question"
android:layout_height="wrap_content"
android:clickable="false"
android:cursorVisible="false"
android:editable="false"
android:lines="3" >
<requestFocus />
</EditText>
<RadioGroup
android:id="@+id/answers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" >
<RadioButton
android:id="@+id/a0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="RadioButton"
android:textColor="@android:color/black" />
<RadioButton
android:id="@+id/a1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="RadioButton"
android:textColor="@android:color/black" />
<RadioButton
android:id="@+id/a2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="RadioButton"
android:textColor="@android:color/black" />
<RadioButton
android:id="@+id/a3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="RadioButton"
android:textColor="@android:color/black" />
</RadioGroup>
</TableLayout>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<Button
android:id="@+id/Prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.21"
android:text="<<" />
<Button
android:id="@+id/finish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.18"
android:text="Finish" />
<Button
android:id="@+id/Next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.23"
android:text=">>" />
</LinearLayout>
</RelativeLayout>
android:textColor="@color/base_tabpager_indicator_color"
base_tabpager_indicator_color.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="#fffb9749" />
<item android:color="#ffffffff" />
</selector>
From your layout, you'll need to set your textColor
to a Drawable Selector file.
That file will define the state_checked
, state_selected
and normal states.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="@android:color/black" />
<item android:state_pressed="true" android:color="@android:color/black" />
<item android:color="@color/colorPrimary" />
</selector>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@drawable/txt_segmented"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With