listview被填充后,焦点将移至第四项
|
我在RelativeLayout中使用listview。用高效适配器填充listview后,焦点移动将直接转到listview的第四个元素。当列表视图填充项目或刷新时,我想将选择移至列表视图的第一项。
下面是代码:
mAdapter_New.notifyDataSetChanged();
lt1.addFooterView(footerView);
lt1.setAdapter(mAdapter_New);
lt1.setSelection(0);
lt1.setSelectionAfterHeaderView();
布局文件如下:
<?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=\"false\"
android:clickable=\"true\"
android:background=\"@color/White\"
android:cacheColorHint=\"#00000000\">
</ListView>
没有找到相关结果
已邀请:
1 个回复
车料