http://img683.imageshack.us/img683/645/weatherscreenmockupoutl.pngGridViewまたはTableLayout?
私はこのレイアウトをコーディングする最良の方法を尋ねています。基本的に、私はちょうど等幅の7列を取得する方法を知る必要があります。
ありがとうございます!
http://img683.imageshack.us/img683/645/weatherscreenmockupoutl.pngGridViewまたはTableLayout?
私はこのレイアウトをコーディングする最良の方法を尋ねています。基本的に、私はちょうど等幅の7列を取得する方法を知る必要があります。
ありがとうございます!
希望の幅であれば、等しい体重の子供を持つlinearLayoutに行くことができます。次のXMLをチェックしてください。
<LinearLayout
layout:orientation="horizontal"
>
<LinearLayout
android:id = "@+id/firstcolumn"
android:layout_weight="1"
android:orientation="vertical"
android:layout_width="0dp"
>
// do the same for your rest of the six children
</LinearLayout>
TableLayout
は、列の数が変更されないため、より良いようです。 GridView
では、アダプターやものを追加する必要があります。
TableRayoutをTableRowと組み合わせて、簡単に行と列を作成できます。
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="@+id/tableRow3"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button1"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/button2"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/button3"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/button4"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
最高のGridViewのを使用することです:
これは4つのボタン(例えばのLinearLayout insidea置く)と2x2のグリッドとの一例です。このようsomeothing試してみてください:
<GridView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:numColumns="7" />
明白な解決策のように思えるが、静的コンテンツのため、私はまだのLinearLayoutで行くと思います。 GridViewには、アダプタを実装する必要があります。 – timoschloesser
/>
<GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="90dp"
android:numColumns="7"
android:stretchMode="columnWidth"
android:gravity="center"
/>
この..
表のレイアウトが正常に動作しますしてみてください.... –