I want to highglight the default selection of a simple list view. Highlighting works, as frequently discussed here, with the onItemClickListener, but how can I highlight the default selection of the simple_list_view?
xml:
<ListView
android:choiceMode="singleChoice"
android:id="@+id/list"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
java:
listView = (ListView) popupView.findViewById(R.id.list);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
//this is of course not called for the default selection
}
});
listView.setItemChecked(0, true);
listView.setSelection(0);