How To Highlight Android Listview First Item After Load Items To Listview?
1.This is my listview Copy
Have getter and setter in adapter with selected position and use the variable and highlight the selected row in getView of adapter.
or
You're performing click right.
In onItemClick, view.setSelected(true); but your drawable xml should have something like
<?xml version="1.0" encoding="utf-8" ?><selectorxmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:state_selected="true"android:drawable="@color/pressed_color"/><itemandroid:drawable="@color/default_color" /></selector>or
lv_FromTable.setItemChecked(0,true);
Edit : Don't forget, without the listSelector above wont work
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:listSelector="@drawable/list_selector_background" />
Post a Comment for "How To Highlight Android Listview First Item After Load Items To Listview?"