Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在listview被填满后,关注第四项_Android_Android Layout - Fatal编程技术网

Android 在listview被填满后,关注第四项

Android 在listview被填满后,关注第四项,android,android-layout,Android,Android Layout,我正在RelativeLayout中使用listview。在用高效适配器填充listview之后,焦点移动将直接转到listview的第四个元素。我想在listview中填充项或刷新时,将所选内容转到listview的第一项。 代码如下: mAdapter_New.notifyDataSetChanged(); lt1.addFooterView(footerView); lt1.setAdapter(mAdapter_New); lt1.setSelection(0);

我正在RelativeLayout中使用listview。在用高效适配器填充listview之后,焦点移动将直接转到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>