-1

次のようなレイアウトを作成する必要があります: ここに画像の説明を入力 gridlayout を使用してこれを実行しようとしていますが、正しい方法が見つかりません。誰でも私にいくつかのガイダンスを教えてもらえますか? ありがとう!

4

2 に答える 2

0

最も簡単な方法は、 horizo​​ntal と vertical を組み合わせその LinearLayoutsサブビューに異なる設定weightsをすることだと思います。

このコード スニペットは出発点になる可能性があります。

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="100dp" >

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@color/green"
        android:layout_margin="5dp" >

    </RelativeLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:orientation="vertical" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_margin="5dp"
            android:background="@color/orange" >
        </RelativeLayout>

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:layout_margin="5dp"
            android:background="@color/green" >
        </RelativeLayout>
    </LinearLayout>
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="100dp" >

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_margin="5dp"
        android:layout_weight="0.5"
        android:background="@color/orange" >

    </RelativeLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_margin="5dp"
        android:layout_weight="1"
        android:background="@color/black" >

    </RelativeLayout>
</LinearLayout>

このようなレイアウトになります.-

レイアウト例

PinterestListViewも有望に見えます。

于 2013-09-23T09:12:42.523 に答える