ViewPager留出边 显示左右两边的视图

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/pager_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clipChildren="false"
    android:layerType="software" >

    <android.support.v4.view.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="250dp"
        android:layout_height="450dp"

android:layout_marginLeft="@dimen/size_30px"
android:layout_marginRight="@dimen/size_30px"
android:clipChildren="false" /> </RelativeLayout>

发现上面的RelativeLayout(可以用其它layout替换)和ViewPager的android:clipChildren都设置为了false。

android:clipChildren表示是否限制子View在其范围内,默认为true。

    如此就可以 实现 两边 留边能看见视图的ViewPager

猜你喜欢

转载自www.cnblogs.com/bimingcong/p/10863864.html