0

タイル UI を持つアプリを実行しています。内部に2つのテーブル行があるテーブルレイアウトを使用しているため、問題がありますが、最初の行を少し縮小する必要がありますが、すでにパディングとマージンを使用してみました (android:paddingBottom & android:layout_marginBottom )しかし、やりたいことをするために最初の行を縮小する方法がわかりません。私がやりたいことをよりよく説明する 2 つの画像を添付しました。最初の画像は、ここに入力したコードで取得したものです。2番目は、私がやりたいことをよりよく説明しています。

レスポンシブ UI を作成する必要があるため、固定の android:layout_height を使用することは考えていませんでした。

これは私が持っているものです:

これは私が持っているものです

これは私がやりたいことです:

これが私がやりたいことです

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <Button
            android:id="@+id/button1"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="2dp"
            android:layout_weight="1"
            android:background="@drawable/camera"
            android:gravity="top|center_horizontal"
            android:onClick="camera" />

        <Button
            android:id="@+id/button2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="2dp"
            android:layout_weight="1"
            android:background="@drawable/gallery"
            android:gravity="top|center_horizontal"
            android:onClick="gallery" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1" >

        <Button
            android:id="@+id/button3"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="2dp"
            android:layout_weight="1"
            android:background="@drawable/bank_bbva"
            android:gravity="top" />
    </TableRow>
</TableLayout>
4

2 に答える 2

0

レイアウトでこれを試してみませんか?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

<Button
        android:id="@+id/button1"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_margin="2dp"
        android:layout_weight="0.5"
        android:background="@drawable/camera"
        android:gravity="top|center_horizontal"
        android:onClick="camera" />

    <Button
        android:id="@+id/button2"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_margin="2dp"
        android:layout_weight="0.5"
        android:background="@drawable/gallery"
        android:gravity="top|center_horizontal"
        android:onClick="gallery" />
</LinearLayout>

<Button
        android:id="@+id/button3"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_margin="2dp"
        android:layout_weight="1"
        android:background="@drawable/bank_bbva"
        android:gravity="top" />

</LinearLayout>
于 2014-05-12T05:14:45.210 に答える