Skip to content

Instantly share code, notes, and snippets.

@Reacoder
Created July 23, 2014 08:12
Show Gist options
  • Save Reacoder/84ec29c05589ba01ff69 to your computer and use it in GitHub Desktop.
Save Reacoder/84ec29c05589ba01ff69 to your computer and use it in GitHub Desktop.
list item 选中状态。
item_layout's background.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_music_list_item_selected" android:state_pressed="true"></item>
<item android:drawable="@drawable/bg_music_list_item_selected" android:state_selected="true"></item>
<item android:drawable="@drawable/bg_music_list_item_selected" android:state_activated="true"></item>
<item android:drawable="@drawable/bg_music_list_item_normal" ></item>
</selector>
mDrawerList = (ListView) findViewById(R.id.left_drawer);
mDrawerList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
mDrawerList.setItemChecked(position, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment