我正在尝试编写一个活动,该活动显示带有一些图像的 viewpager 和下面带有一些数据的 listview .. 但我的问题是我只能在屏幕的最后部分滚动 listview 我想让 viewpager 可以滚动listview 所以我想把它作为标题.. 这是我的 XMl 文件
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<com.devsmart.android.ui.HorizontalListView
android:id="@+id/sectionsList"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:background="@drawable/menu_bg" />
<include layout="@layout/main_screen_components" />
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
我在课堂上写这个
@Override
protected void onPostExecute(List<News> result) {
Utils.pagerNews(result);
Utils.listNews(result);
ImagePagerAdapter pAdapter = new ImagePagerAdapter(
appManager.getPagerNews());
pager.setAdapter(pAdapter);
View headerView = getLayoutInflater().inflate(R.layout.main_screen_components , null , false);
NewsListAdapter adapter = new NewsListAdapter(getBaseContext(),
appManager.getListNews());
listView.addHeaderView(headerView);
listView.setAdapter(adapter);
progress.dismiss();
}
当我运行这段代码时,它给了我一个重复的寻呼机..用数据修复了一个,一个空的作为我的列表视图的标题..当我删除其中包括我的寻呼机时,当我尝试为寻呼机设置适配器时它崩溃。 。 任何的想法 ?