So i made these two buttons.
I want to be able to click the button i made and have the button change to the whited-out image of the original button instead of on and off states you would have in a toggle button.
so far all I’ve figured out is something to do with stateListDrawable xml, which i placed in the 3 drawable folders. Thats the only place I’ve found it belongs, however, i don’t know where to reference the .xml file to the main. Do you do this programmatically? If so point me in the right direction of a good tutorial. The android dev page is foreign to me. And i would have posted the buttons so you would have a better idea, but i can’t until i get some more points. What a gimmick!
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/toggle_selection_pressed" />
<item android:drawable="@drawable/toggle_selection" />
</selector>
You’ll need a variable to keep the state of the button. Put this in the main class declaration