0

現在、Android アプリの GUI 内で特定の要素を整列させる方法を考え出そうとしています。下の画像リンクをご覧ください。最初のレイアウトが現在のもので、2番目が私が目指しているものです。現在、2 つの線形レイアウトを使用しています。右側のボタンと EditText に相対レイアウトとテーブル レイアウトを使用しようとしましたが、常に EditText が縮小されるか、タブレットの画面サイズからオーバーフローします。

ご協力いただきありがとうございます!

画像リンク: ( http://postimage.org/image/pptkdkomx/ )

4

3 に答える 3

2

これを試して:

<?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="match_parent"
android:orientation="horizontal" >

<ImageView
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="0.5" />

<LinearLayout
    android:layout_width="0dp"
    android:layout_height="match_parent"
    android:layout_weight="0.5"
    android:orientation="vertical" >

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

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.5" android:text="Button1"/>

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="0.5"  android:text="Button2"/>
    </LinearLayout>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

</LinearLayout>
于 2013-02-28T14:27:00.010 に答える
1

使っRelativeLayoutてみませんかEditTextandroid:layout_alignBottom="myImage"

于 2013-02-28T14:33:44.860 に答える
1

簡単なテンプレートをまとめました。メモ帳のみを使用したため、修正して独自の属性を追加する必要がある場合があります。

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

    <ImageView
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="50"/>

    <LinearLayout 
        android:orientation="vertical"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="50">

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

            <Button android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="50"/>

            <Button android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="50"/>

        </LinearLayout>

        <EditText
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

    </LinearLayout>

</LinearLayout>
于 2013-02-28T14:48:24.243 に答える