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

相關文章
相關標籤/搜索