Android View Flipper自定义绘图

我对视图鳍状肢有一些怀疑

我正在使用viewflipper使用scroll_left转到另一个视图
动画.

我在ViewFlipper中保留了2个linearlayout

现在我要4个意见….

像第一个视图包含3个btns.

第一个btn点击 – >第二个视图滚动 – >后退第一个视图滚动
背部
第二个btn点击 – >第三个视图滚动 – >后退第一个视图滚动
背部
第3个btn点击 – >第四个视图滚动 – >后退第一个视图滚动
背部

那么,我如何安排4个linearlayout在flipNext中工作….

现在理想情况下,2,3,4个视图仅处于第二级导航中.一世
想要在2,3,4视图出现时绘制直线,点或矩形,
但它们都是不同的形状.那么绘制的方法是什么
那个?

最佳答案 您可以通过以下方式执行此操作:

<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();
点赞