[quote] ListView添加ViewPager listView.addHeaderView(viewPager);[/quote]
[quote]viewpager_layout1.xml[/quote]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager1"
android:layout_width="match_parent"
android:layout_height="300dp"
/>
</LinearLayout>
[quote]viewpager_layout2.xml
下面布局中
android:layout_width="match_parent"
android:layout_height="300dp"
属性无效
必须用代码方式设置宽和高
viewPager.setLayoutParams(new ListView.LayoutParams(
ListView.LayoutParams.MATCH_PARENT, 300)); 设置宽高[/quote]
[quote]viewpager_layout2.xml[/quote]
[quote][size=large]源码地址http://pan.baidu.com/share/link?shareid=1731088090&uk=2099615464[/size][/quote]