1

左側にユーザ​​ーが選択できるナビゲーション ボタンがあるタブレット用の ViewPager を作成する必要があります。例えば。

左側のナビゲーションには 4 つの画像ボタンがあり、各項目からユーザーは別のチュートリアルに移動します。各画像ボタンは ViewPager をロードします。

ユーザーが項目 1 を選択すると、ページの右側にチュートリアル #1 の ViewPager が読み込まれますが、左側のナビゲーションはそのままです。そのため、ユーザーがページをスワイプすると、ナビゲーションが常に表示され、別のページに移動できるようになります。チュートリアル。動作は、すべての ImageButton アイテムで同じです。

例を検索しましたが、私が説明しているようなものは見当たりませんでした。そうでない場合、この設計に代わる可能性のあるものは何ですか?

更新され、含まれている xml レイアウト。

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

    <include
        android:id="@+id/headerbar"
        layout="@layout/header" />

    <LinearLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <include layout="@layout/left_nav" />

        <android.support.v4.view.ViewPager
            android:id="@+id/homeScreenPager"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

        <com.viewpagerindicator.CirclePageIndicator
            android:id="@+id/indicator"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/navbar_bg"
            android:padding="10dip" />

    </LinearLayout>

</LinearLayout>
4

1 に答える 1

1

例を検索しましたが、私が説明しているようなものは見当たりませんでした。

水平を使用しLinearLayoutます。2 人の子供を持つ:

  • LinearLayout「4 つの画像ボタン」の垂直
  • aViewPager

ボタンをクリックすると、 に新しいアダプターをセットしますViewPager

于 2012-12-23T18:54:05.663 に答える