I am using listview in RelativeLayout. After filling listview with Efficient Adapter, the focus movement is directly going to fourth element of listview. I want to go the selection to first item of listview when listview filled with item or refreshed. Below is the code:
mAdapter_New.notifyDataSetChanged();
lt1.addFooterView(footerView);
lt1.setAdapter(mAdapter_New);
lt1.setSelection(0);
lt1.setSelectionAfterHeaderView();
The layout file is as below:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@color/White">
<RelativeLayout .... >
<LinearLayout ...>
</LinearLayout>
</RelativeLayout>
<ListView
android:layout_width="fill_parent"
android:id="@+id/listtv01"
android:layout_alignParentTop="false"
android:layout_below="@+id/ril_prg"
android:layout_height="fill_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:fitsSystemWindows="true"
android:divider="@color/Grey"
android:dividerHeight="1dip"
android:headerDividersEnabled="false"
android:footerDividersEnabled="fals开发者_如何转开发e"
android:clickable="true"
android:background="@color/White"
android:cacheColorHint="#00000000">
</ListView>
The first item in listview does not gets the focus
精彩评论