I am trying to change the colors of the indicator on the
ToggleButton.  I simply want the unchecked indicator to be green and
the checked indicator to be red.  I copied the drawable xmls and png
files from the 1.6 source code and placed them into my project's
drawable directory.  In btn_toggle_bg.xml I get the error:

Description     Resource        Path    Location        Type
ERROR Error: Resource is not public. (at 'drawable' with value
'@android:drawable/btn_toggle').        btn_toggle_bg.xml       
/Timer/res/drawable
line 19 Android AAPT Problem

Line 19 is this:

<item android:id="@+android:id/toggle"
android:drawable="@android:drawable/btn_toggle" />

Not knowing what the problem was (btn_toggle.xml is definitely there)
I changed btn_toggle_bg.xml to include the contents of btn_toggle.xml,
like this:

<layer-list xmlns:android="http://schemas.android.com/apk/res/
android">
    <item android:id="@+android:id/background"
android:drawable="@android:drawable/btn_default_small" />

    <selector android:id="@+android:id/toggle">
      <item android:state_checked="false" android:drawable="@drawable/
btn_toggle_green" />
      <item android:state_checked="true" android:drawable="@drawable/
btn_toggle_red" />
    </selector>
</layer-list>


That didnt give me the error, but not the toggle button does not
display the indicator at all.

What is the easiest way to change the indicator colors on a
ToggleButton?

Thanks!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to