0

I am working on a android project where i need to add radio buttons as a text like following image enter image description here

Both text are radio buttons and clickable. To get this view i create a resources file with the name custom button

<item android:state_pressed="true" >
    <shape android:shape="rectangle" >
        <corners android:radius="3dip" />
        <stroke android:width="1dip" android:color="#333333" />
        <solid android:color="#cccccc" />
    </shape>
</item>

<item android:state_checked="true">
    <shape android:shape="rectangle" >
        <corners android:radius="3dip" />
        <stroke android:width="1dip" android:color="#333333" />
        <solid android:color="#cccccc" />
    </shape>
</item>

<item
    android:bottom="1dp"
    android:left="-2dp"
    android:right="-2dp"
    android:top="-2dp">
    <shape android:shape="rectangle" >
        <stroke
            android:width="1dp"
            android:color="#FF000000" />

        <solid android:color="#00FFFFFF" />

        <padding android:left="10dp"
            android:right="10dp"
            android:top="10dp"
            android:bottom="10dp" />
    </shape>
</item>

now i am setting this layout to my view as

 <RadioButton
    android:id="@+id/radio0"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/custom_button_background"
    android:button="@android:color/transparent"
    android:checked="false"
    android:text="RadioButton1"
    android:layout_alignParentTop="true" />

Every thing is working fine bt m not able to set the border only to the bottom of my radio button text please help me to find out a way

Pankaj Agrawal
  • 1,469
  • 2
  • 17
  • 27

0 Answers0