0

私は誰かが同じような質問をするかどうか確かめようとしましたが、運がありませんでした。私はこのようなレイアウトを構築する方法を理解しようとしてきました:

私が達成しようとしているレイアウト付きの画像。

最初はいくつかの異なるレイアウトを試しましたが、左側に2行のテーブルと右側に2 x 2行/列のテーブルがある2列のテーブルであるため、テーブルは機能する可能性があると思いましたが、TableLayoutどのように機能しませんか?考えました(列を追加する方法がわかりませんでした)。グリッドは私を近づけるように見えますが、画像のように画面をセクションに分割しようとするのではなく、ボタンの完全なグリッドを実行する場合にのみ機能するようです。

誰かアドバイスがありますか、またはこのようなことを最もよく達成する方法について正しい方向に私を向けることができますか?

ソリューションを投稿するのに十分な担当者がいませんが、このレイアウトに似たコードのクイックバージョンを次に示します(ボタンのみが拡大縮小されておらず、タイトルは画像です)。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainMenu" >

<ImageButton
    android:id="@+id/ImageButton03"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:layout_marginRight="19dp"
    android:layout_marginTop="27dp"
    android:scaleType="fitCenter"
    android:src="@drawable/ic_launcher" />

<ImageButton
    android:id="@+id/ImageButton01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/ImageButton03"
    android:layout_marginRight="108dp"
    android:layout_toLeftOf="@+id/ImageButton03"
    android:scaleType="fitCenter"
    android:src="@drawable/ic_launcher" />

<ImageButton
    android:id="@+id/ImageButton02"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/ImageButton01"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="29dp"
    android:scaleType="fitCenter"
    android:src="@drawable/ic_launcher" />

<ImageButton
    android:id="@+id/ImageButton04"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/ImageButton02"
    android:layout_toRightOf="@+id/ImageButton01"
    android:scaleType="fitCenter"
    android:src="@drawable/ic_launcher" />

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignTop="@+id/ImageButton01"
    android:layout_marginLeft="18dp"
    android:src="@drawable/ic_launcher" />

<ImageButton
    android:id="@+id/ImageButton05"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/imageView1"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="14dp"
    android:scaleType="fitCenter"
    android:src="@drawable/ic_launcher" />

4

1 に答える 1

0

ここで私がどのように私が前に設計したので、あなたはそれを理解しました:

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

<LinearLayout
    android:layout_width="300dp"
    android:layout_height="match_parent"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:orientation="vertical" >

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

        <Button
            android:id="@+id/button2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1.0"
            android:text="Button" />

        <Button
            android:id="@+id/button3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1.0"
            android:text="Button" />

    </LinearLayout>

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

        <Button
            android:id="@+id/button5"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1.0"
            android:text="Button" />

        <Button
            android:id="@+id/button4"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1.0"
            android:text="Button" />

    </LinearLayout>

</LinearLayout>

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="Large Text"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:text="Button" />

于 2013-03-11T20:38:23.657 に答える