次のようなレイアウトを作成する必要があります:
gridlayout を使用してこれを実行しようとしていますが、正しい方法が見つかりません。誰でも私にいくつかのガイダンスを教えてもらえますか? ありがとう!
2 に答える
0
最も簡単な方法は、 horizontal と 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 に答える