I am using RadioButton
in my layout. Where i have provided background to the RadioButton
. Below is the code
<RadioGroup
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:background="@drawable/rb_spain"
android:id="@+id/am_rb_spain" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:background="@drawable/rb_germany"
android:layout_marginLeft="@dimen/margin_15"
android:layout_marginRight="@dimen/margin_15"
android:id="@+id/am_rb_german" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:background="@drawable/rb_english"
android:id="@+id/am_rb_english" />
</RadioGroup>
RadioButton
background drawable
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://ift.tt/nIICcg" >
<item android:state_checked="false" android:drawable="@drawable/ic_spain" />
<item android:state_checked="true" android:drawable="@drawable/ic_spain_pressed" /> //pressed image is Large in size
<item android:drawable="@drawable/ic_spain" /> <!-- default -->
</selector>
I have saved the selection in TinyDB
so that app will remember my selection whenever i open my app. But whenever i open my app the default selected RadioButton background Appears Large. I have taken all the images of same size in drawable's with same padding.
First flag is Default selected here. But it appear to be slightly large in size
Now i have pressed 2nd flag. But first flag is not coming to its normal state.
Aucun commentaire:
Enregistrer un commentaire