質問

私は今、数日間、このいじりてきた、ここでうまくいけば、誰かが私に手を貸すことができます。

私は、単純な2列のレイアウトを持って、左側にはボタン付きのナビゲーションバーで、右側がコンテンツパネルです。ユーザーがいずれかのボタン(たとえば、第三1ダウン)をタップすると、私は、このボタンの右側が、コンテンツペインの上部に浮いに整列浮動ビューを持っているしたいと思います。ここで私が何を意味するか説明する画像です: レイアウト

すべて私が私が欲しいものではありませんこれは、突きつけにナビゲーションバーの内側やコンテンツパネル内の浮動メニューを試してみました。何か案は?ここで私がこれまで持っているものは基本的です。

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal"
>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:layout_alignParentLeft="true"
        android:id="@+id/navigation_bar"
    >
        <FrameLayout 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.14"
        >
            <ImageButton 
                android:id="@+id/button1_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/icon"
                android:layout_gravity="center"
            />
        </FrameLayout>
        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.14"
        >
            <ImageButton 
                android:id="@+id/button2_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/icon"
                android:layout_gravity="center"
            />
        </FrameLayout>
    </LinearLayout>
    <FrameLayout
        android:id="@+id/content"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="0.14"
        android:layout_toRightOf="@id/navigation_bar"
    >
    </FrameLayout>
</RelativeLayout>
役に立ちましたか?

解決

でframeLayoutは、あなたが別のビューを重ねビューを持つことができます。私はそれはあなたがあなたの例では持っているように、一つだけ子ビューでそれらを持っていることは理にかなってわかりません。最初の子要素、および第二子としてのフローティングメニューとしてあなたの「静的」ビューで、最高レベルでframeLayoutを持ってみてください。

開発者向けドキュメントは良いの概要を持っているレイアウトタイプは、それはあなたが始めるのに役立つかもしれません。

他のヒント

RelativeLayoutは、あなたが望むものである。
FrameLayoutは、唯一の子を持っている必要があり、したがって、通常、唯一の他のレイアウトが(そのような活性のメインフレームとして)後に来るプレースホルダのために使用される。
AbsoluteLayoutは廃止され、かつ使用すべきではありません。

RelativeLayoutは、ビューが重なることを可能にする、そして、ほとんど、あなたが望む何もできます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top