我对view flipper有一些疑问。
我正在使用viewflipper转到另一个使用scroll_left动画的视图。
我在ViewFlipper中保留了两个线性布局
现在我想要4个视图...
如第一个视图包含3btn。
第1个btn单击->第2个视图在->中滚动后按第1个视图向后滚动第2个btn单击->第3个视图在->中滚动后按第1个视图向后滚动第3个btn单击->第4个视图在->中滚动后按第1个视图
那么,我该如何在flipNext中安排4个线性布局呢……
现在,理想情况下,2、3、4个视图仅在第二级导航中。当2,3,4个视图出现时,我想画一条线,点或矩形,但它们都是不同的形状。那么绘制它的方法是什么呢?
发布于 2010-07-06 15:21:14
您可以通过以下方式进行操作:
<LinearLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/header">
<TextView
android:id="@+id/header_text"
android:gravity="center"
android:textSize="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TextView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_width="fill_parent"
android:paddingBottom="5px">
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<include android:id="@+id/chatView" layout="@layout/chat_view" />
<include android:id="@+id/userView" layout="@layout/user_view" />
<include android:id="@+id/gameView" layout="@layout/game_view"/>
<include android:id="@+id/allGamesView" layout="@layout/all_game_view" />
</ViewFlipper>如您所见,我定义了一个每次都会显示的TextView。ViewFlipper位于此标头TextView的下方。所以你只需要翻转整个视图的这一部分。要从视图1翻到视图2,只需调用
flipper.showNext();从1翻到3,你只需调用:
flipper.showNext();
flipper.showNext();要从4翻到2,您可以调用:
flipper.showPrevious();
flipper.showPrevious();https://stackoverflow.com/questions/3183653
复制相似问题