我想使用 a将 aListView (ListFragment)
放在里面。但是这样做时似乎禁用了 ListViews 滚动功能(我无法上下滚动)。这是我的代码:ViewPager
FragmentPagerAdapter
主要的.xml
<include layout="@layout/prisniveau_info" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v4.view.PagerTitleStrip
android:id="@+id/pager_title_strip"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="top"
android:background="@color/light_gray"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:textColor="#fff" />
</android.support.v4.view.ViewPager>
适配器:
public class MyAdapter extends android.support.v4.app.FragmentPagerAdapter { public MyAdapter(android.support.v4.app.FragmentManager fm) { super(fm); } @Override public int getCount() { return 2; } @Override public Fragment getItem(int position) { Fragment fragment = null; if(position==0) { fragment = new MyListFragment(); } else if(position==1) { fragment = new MyMapFragment(); } return fragment; } @Override public CharSequence getPageTitle(int position) { switch (position) { case 0: return getString(R.string.title_list).toUpperCase(Locale.getDefault()); case 1: return getString(R.string.title_map).toUpperCase(Locale.getDefault()); } return null; } public String getFragmentTag(int index) { return "android:switcher:" + R.id.pager + ":" + index; } }
是否可以ListView
在 a 内进行滚动ViewPager
?