I want to hide radio button indicator, which shows that radio button is checked or unchecked. I just want to show its text only. And change text color of radio button which is selected in radio group and other radio buttons text will same.
Here is my onCheckedChanged code.
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if(isChecked){
itemView.removeAllViews();
for (Subjects subjects : item.subjects) {
View iv = inflater.inflate(R.layout.expandablelistview_item, itemView, false);
TextView itemName = (TextView) iv.findViewById(R.id.lblListItem);
itemName.setText(subjects.name + " " + subjects.marks);
itemView.addView(iv);
}
}
}
Hide RadioButton indicator with: android:button="@null" xml attribute to RadioButton item.
Then create your own selector like this:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/..."/>
<item android:state_focused="true" android:drawable="@drawable/..."/>
<item android:state_checked="true" android:drawable="@drawable/..."/>
<item android:drawable="@android:color/transparent"/>
</selector>
if you want change text background and use it in android:background RadioButton attribute. Otherwise set android:background="@android:color/transparent"
And color of text you can change with color selector:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true
android:color="@color/..."/>
<item android:state_focused="true"
android:color="@color/..."/>
<item android:state_selected="true"
android:color="@color/..."/>
<item android:state_checked="true"
android:color="@color/..."/>
<item android:color="@color/..."/>
</selector>
and insert it to android:textColor="@color/..." attribute.