2012-03-06 7 views
3

私はViewPagerを表示したいと思っています。ViewPagerは、他のビューよりも画面全体を埋めるようにして、隠しています。 この2番目のビューは、画面の下部に設定され、ユーザーがViewPager上で下から上に向かって飛んだりするときに表示されます。 2番目のビューが表示されるまでViewPagerを上部に移動するアニメーションを実行します。ビューを別のビューに重ねる方法は?

実際、私は第2のビューを重ねることはできません。常にViewPagerで表示され、隠されることはありません。私がXMLでレイアウトを設定するために使用する順序(ViewPagerを最初に宣言し、次に第2のビュー、またはその逆)、またはRelativeLayoutまたはFrameLayoutを使用するものは何でも。ここで

は、私が使用するコードです:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 

    <LinearLayout 
     android:id="@+id/hlist" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:background="@drawable/bg_shelf" 
     android:orientation="horizontal" > 
    </LinearLayout> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/pager" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" /> 

</RelativeLayout> 

答えて

2

私は次のポストを追っ:overlapping views in Androidと私は、次のXML構成で私の見解をオーバーラップすることができました:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <LinearLayout 
     android:id="@+id/hlist" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_gravity="center_vertical" 
     android:background="@drawable/bg_shelf" 
     android:orientation="horizontal" > 
    </LinearLayout> 


    <android.support.v4.view.ViewPager 
     android:id="@+id/pager" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_alignBottom="@id/hlist" 
     android:layout_alignLeft="@id/hlist" 
     android:layout_alignRight="@id/hlist"/> 

</RelativeLayout> 
関連する問題