Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RadioButtons with TextView in RadioGroup

Is it possible to add TextView below RadioButton in RadioGroup in any other way than extending and creating my custom RadioButton?

like image 251
Michal Avatar asked Apr 24 '12 13:04

Michal


1 Answers

Yes, its possible. See below:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <RadioGroup
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn1" />

        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn2" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="sample text" />

    </RadioGroup>

</LinearLayout>

Sample output:

enter image description here

like image 148
waqaslam Avatar answered Oct 06 '22 01:10

waqaslam