You can not use the following state drawable as background for listview items.
<item android:drawable="@drawable/ic_launcher" android:state_activated="true"/>
On Pre Honeycomb Devices because this selector is not supported there and the android version does not keep track of the activated item(s).
How can this behaviour be emulated? Especially when using fragements (list on the left in one fragment and depending on what is selected a detail view on the right) this indicator is very important.
I know that this question was asked before here but the accepted answer there links to a blog article which states in “Step 4” that there is no possibility to have the activated indicator and instead only disables the use to prevent errors. This leads to the fact that no indicator is displayed which is what I’m searching for.
I solved the problem using a small trick: By missusing the
state_checkedproperty, which exists since Android Version 1, it is possible to emulate thestate_activatedbehaviour. There is no need to modify the List adapter or save the state yourself.I wrote a detailed example containing all code necessary to repoduce and published it on a github repository.