0

私はこれに対する答えをあちこち探しましたが、提供された解決策は私の問題を解決しませんでした。

いくつかのビュー(いくつかのボタンと背景)を表示するレイアウトがあります。これに、線形レイアウトを拡張するために作成したカスタムコントロールを追加しました。このコントロールは、レイアウトの上に非常にうまく表示されます。私がやりたいのは、このコントロールよりも大きいImageViewを追加することですが、その前にあります。

編集:申し訳ありませんが、これで問題が解決することを願っています。

アクティビティ用に1つの大きなレイアウト(相対)があります。このレイアウトに2つの追加のビュー\レイアウトを積み重ねて、最終バージョンが添付の画像になるようにします。

ここに画像の説明を入力してください

これは私のレイアウトです。これは、他のメニューの上ではなく、メニューバー上にイメージビューをスタックします。FrameLayoutを別の場所に配置しようとしても、希望する結果が得られませんでした。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background">
    <RelativeLayout android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="450dip">
        <com.myproject.controls.SearchControl
            android:id="@+id/scSearch" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
        />
        <ExpandableListView android:id="@+id/lstItems"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/scSearch"
            android:layout_marginLeft="26dip"
        />
    </RelativeLayout>
    <FrameLayout android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    <com.myproject.controls.MenubarMain
        android:id="@+id/mbMenuBarMain"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom"
    />
    <ImageView android:src="@drawable/myicon"
                android:layout_width="200dip"
                android:layout_height="200dip"
                />
    </FrameLayout>
</LinearLayout>
4

1 に答える 1

0

これが機能するかどうかわからないので、仕事でこれを入力しています。しかし、ここでの話の教訓は、RelativeLayoutの使用に慣れています。レイアウトをより細かく制御できます。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background">
    <com.myproject.controls.MenubarMain
        android:id="@+id/mbMenuBarMain"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">
    </com.myproject.controls.MenubarMain>
    <com.myproject.controls.SearchControl
        android:id="@+id/scSearch" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true">
    </com.myproject.controls.SearchControl>
    <ExpandableListView android:id="@+id/lstItems"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/scSearch"
        android:layout_above="@id/mbMenuBarMain"
        android:layout_paddingLeft="26dp"/>
    <ImageView android:src="@drawable/myicon"
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:layout_alignBottom="@id/mbMenuBarMain"
            android:layout_alignRight="@id/mbMenuBarMain"/>
</RelativeLayout>
于 2011-08-24T17:04:44.620 に答える