Open AntonHolovin opened 10 years ago
This problem can be solved by this example, but it's worse.
twoWayView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
private TextView mLastClickedTextView;
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if(mLastClickedTextView != null) {
mLastClickedTextView.setBackgroundResource(R.drawable.section_background);
}
TextView textView = (TextView) view.findViewById(R.id.text_section_name);
textView.setBackgroundResource(android.R.color.transparent);
mLastClickedTextView = textView;
}
});
I try to set ChoiceMode to ChoiceMode.SINGLE. I want to change background for custom item view when it selected and I wrote selector that checks android:state_activated="true". It doesn't work. The item gets default background every time.
The part of the custom item:
Selector: