I found one workaround for this
we need to use this text/symbol ⭘
and ◉
instead of radio button and add radio button functionality to them.
EXAMPLE:
first create Linear layout for button text and title text
<LinearLayout
android:id="@+id/btn1Layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="⭘"
android:textSize="34sp"
android:textColor="#ffffff"
android:layout_marginStart="25dp"
/>
<TextView
android:id="@+id/btn1txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="2dp"
android:text="Option 1"
android:layout_marginStart="3dp"
android:textSize="16sp"
android:textColor="#ffffff"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="25dp"
android:background="@android:color/darker_gray"/>
<LinearLayout
android:id="@+id/btn2Layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|fill_horizontal"
android:orientation="horizontal">
<TextView
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="⭘"
android:textSize="34sp"
android:textColor="#ffffff"
android:layout_marginStart="25dp"
/>
<TextView
android:id="@+id/btn2txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="2dp"
android:text="Option 2"
android:layout_marginStart="3dp"
android:textSize="16sp"
android:textColor="#ffffff"
/>
</LinearLayout>
LinearLayout btn1Layout = findViewById(R.id.btn1Layout);
LinearLayout btn2Layout = findViewById(R.id.btn2Layout);
TextView btn1 = (TextView) findViewById(R.id.btn1);
TextView btn2 = (TextView) findViewById(R.id.btn2);
btn1.setText(⭘);
btn2.setText(⭘);
if(selectedId != null) {
TextView selectedBtn = (TextView) findViewById(selectedId);
selectedBtn.setText(◉);
}
then set click listners to the all Layouts for updating btn symbols.
btn1Layout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
selectedId = btn1.getId();
btn1.setText(◉);
btn2.setText(⭘);
}
});