Hi.

So I have a radio group, and instead of having the traditional view, I want 
to have be a png image I have. And when that radio button is activated is 
one image, and when it is not, then it is another image.

I think I have all the right code, but still, all the images might change 
the first time (changing from deactivated to activated), but never go back 
to deactivated mode.

This is the code for the images:

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android"; >

<item android:drawable="@drawable/camon" android:state_checked="true" 
android:state_pressed="false" />

    <item android:drawable="@drawable/camoff" android:state_checked="false" 
android:state_pressed="false" />

    <item android:drawable="@drawable/camon" android:state_checked="true" 
android:state_pressed="true" />

    <item android:drawable="@drawable/camoff" android:state_checked="false" 
android:state_pressed="true" />

</selector>


And the code in main xml:

<RadioGroup

            android:id="@+id/radioGroup1"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:orientation="vertical" >


            <TableRow

                android:id="@+id/tableRow3"

                android:layout_width="match_parent"

                android:layout_height="wrap_content"

                android:gravity="center" >


                <RadioButton

                    android:id="@+id/radio0"

                    android:layout_width="wrap_content"

                    android:layout_height="wrap_content"

                    android:checked="true"

                    android:text="" 

                    android:background="@drawable/radio_1" 

                    android:button="@null" />


                <RadioButton

                    android:id="@+id/radio1"

                    android:layout_width="wrap_content"

                    android:layout_height="wrap_content"

                    android:background="@drawable/radio_2"

                    android:text=""

                    android:button="@null" />


            </TableRow>


            <TableRow

                android:id="@+id/tableRow4"

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:gravity="center" >


                <TextView

                    android:id="@+id/TextView01"

                    android:layout_width="match_parent"

                    android:layout_height="wrap_content"

                    android:text="View 1"

                    android:textAppearance=
"?android:attr/textAppearanceSmall" />


                <TextView

                    android:id="@+id/textView2"

                    android:layout_width="match_parent"

                    android:layout_height="wrap_content"

                    android:text="View 2"

                    android:textAppearance=
"?android:attr/textAppearanceSmall" />

            </TableRow>


            <TableRow

                android:id="@+id/tableRow1"

                android:layout_width="match_parent"

                android:layout_height="wrap_content" 

                android:gravity="center" >


                <RadioButton

                    android:id="@+id/radio2"

                    android:layout_width="wrap_content"

                    android:layout_height="wrap_content"

                    android:background="@drawable/radio_3"

                    android:text=""

                    android:button="@null" />


                <RadioButton

                    android:id="@+id/radio3"

                    style="@drawable/button_radio"

                    android:layout_width="wrap_content"

                    android:layout_height="wrap_content"

                    android:background="@drawable/radio_4"

                    android:text=""

                    android:button="@null" />


            </TableRow>

            

            <TableRow

                android:id="@+id/tableRow4"

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:gravity="center" >


                <TextView

                    android:id="@+id/TextView03"

                    android:layout_width="match_parent"

                    android:layout_height="wrap_content"

                    android:text="View 3"

                    android:textAppearance=
"?android:attr/textAppearanceSmall" />


                <TextView

                    android:id="@+id/textView4"

                    android:layout_width="match_parent"

                    android:layout_height="wrap_content"

                    android:text="View 4"

                    android:textAppearance=
"?android:attr/textAppearanceSmall" />

            </TableRow>

        </RadioGroup>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to