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。html

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

    如此就能够 实现 两边 留边能看见视图的ViewPagerspa

相关文章
相关标签/搜索