我想实现这样的东西:http ://android-developers.blogspot.in/2011/08/horizontal-view-swiping-with-viewpager.html 。
我的主视图是一个 Viewflipper,在卡片的两侧有两个视图。如何在 viewflipper 布局上方实现一个 viewpager?我现在的布局是这样的:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@id/FlashCardFront" android:background="#3500ffff style="@style/Fill"
xmlns:android="http://schemas.android.com/apk/res/android">
<ViewFlipper android:id="@+id/flipper" style="@style/Fill" android:layout_margin="8.0dip">
<LinearLayout android:id="@+id/front" android:orientation="vertical" android:background="#ffffffff" style="@style/Fill">
<LinearLayout style="@style/FillWrap.LL.FlashCard_Header">
<ImageButton
android:id="@+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="true"
android:src="@drawable/left_arrow"
android:background="#00000000"
/>
<TextView android:id="@id/TV_CardNo" android:text="0000" android:layout_weight="1.0" style="@style/Wrap.Text_RightTop" />
<ImageButton
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.14"
android:background="#00000000"
android:onClick="true"
android:src="@drawable/right_arrow" />
</LinearLayout>
<LinearLayout android:id="@id/LL_Card" style="@style/FillWrap.LL.FlashCard_Body">
<TextView android:id="@id/TV_Word" android:text="Word" style="@style/FillWrap.Text_FlashCard_Word" />
</LinearLayout>
<LinearLayout style="@style/FillWrap.LL.FlashCard_Footer">
<RatingBar android:id="@id/RB_Stars_Front" android:progressDrawable="@drawable/ratings_bar" android:numStars="1" android:stepSize="1.0" style="@style/Wrap" />
</LinearLayout>
</LinearLayout>
<LinearLayout android:orientation="vertical" android:background="#ffffffff" style="@style/Fill">
<LinearLayout android:id="@id/RearHeader" style="@style/FillWrap.LL.FlashCard_Header">
<ImageButton
android:id="@+id/rear_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="true"
android:src="@drawable/left_arrow"
android:background="#00000000"
/>
<TextView android:id="@id/TV_CardNo" android:text="0000" android:layout_weight="1.0" style="@style/Wrap.Text_RightTop" />
<ImageButton
android:id="@+id/rear_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.14"
android:background="#00000000"
android:onClick="true"
android:src="@drawable/right_arrow" />
</LinearLayout>
<LinearLayout android:id="@id/LL_Card1" style="@style/FillWrap.LL.FlashCard_Body">
<ImageView android:id="@+id/image" android:layout_width="fill_parent" android:layout_height="fill_parent"></ImageView> </LinearLayout>
<LinearLayout style="@style/FillWrap.LL.FlashCard_Footer">
<TextView android:id="@id/TV_Meaning" android:text="Meaning" style="@style/FillWrap.Text_FlashCard_Meaning" />
</LinearLayout>
</LinearLayout>
</ViewFlipper>