Android中图片的左右切换随处可见,今天我也试着查阅资料试着做了一下,挺简单的一个小Demo,却也发现了一些问题,话不多说,上代码~:
使用了3个xml文件作为ViewPager的滑动page,布局都是相同的,如下只展示其中之一:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@mipmap/view1"/>
只是用了一个ImageView作为显示图片的容器
主页面布局:
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/viewPager">
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/viewGroup"
android:layout_alignPar