I want to have the following: a textview that .)changes its background when clicked .)maintains that background until it is clicked again
it all comes down to the "checkable" state, but i couldnt figure out how this exactly works. here is the xml i am using for background:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- pressed -->
<item android:drawable="@drawable/menuselected"
android:state_pressed="true" />
<!-- checked -->
<item android:drawable="@drawable/menuselected"
android:state_checked="true" />
<!-- default -->
<item android:drawable="@drawable/transpixel"/>
</selector>
Update: it partly works now. I adopted most of the code from http://kmansoft.com/2011/01/11/checkable-image-button/ for my custom Textview. I did this as actually, I need the functionality of a radio button as well. Now I can check a Textview, but I cant uncheck it. Does anybody see why that could be the case?
You can use CheckedTextView with checkMark null and background your selectable
your selectable can be