0

私はAndroidSMSメッセンジャーに組み込まれているような機能の類似性を必要とするアプリケーションを開発しています。

私は次のことをしようとしました:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:a="http://schemas.android.com/apk/res/android"
                a:layout_width="fill_parent"
                a:layout_height="fill_parent">
    <LinearLayout
            a:orientation="vertical"
            a:layout_height="wrap_content"
            a:layout_width="fill_parent">
        <EditText
                a:id="@+id/smsRecipients"
                a:layout_height="wrap_content"
                a:layout_width="fill_parent"
                a:hint="@string/sms_to_whom"/>
        <Button
                a:layout_height="wrap_content"
                a:layout_width="fill_parent"
                a:text="@string/sms_contacts"
                />
    </LinearLayout>

    <LinearLayout a:layout_alignParentBottom="true"
                  a:orientation="horizontal"
                  a:layout_width="fill_parent"
                  a:layout_height="wrap_content"
                  a:paddingTop="5dip"
                  a:paddingBottom="5dip"
                  a:paddingLeft="5dip"
                  a:paddingRight="5dip"
                  a:background="#dcdcdc">
        <EditText
                a:id="@+id/smsBody"
                a:layout_width="0dip"
                a:layout_height="wrap_content"
                a:layout_weight="1.0"
                a:autoText="true"
                a:capitalize="sentences"
                a:nextFocusRight="@+id/send_button"
                a:hint="@string/sms_enter_message"
                a:maxLines="10"
                a:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
                a:imeOptions="actionSend|flagNoEnterAction"/>
        <LinearLayout a:orientation="vertical" a:layout_width="wrap_content" a:layout_height="fill_parent">
            <Button
                    a:id="@+id/smsSendButton"
                    a:layout_marginLeft="5dip"
                    a:layout_width="wrap_content"
                    a:layout_height="0dip"
                    a:layout_weight="1.0"
                    a:nextFocusLeft="@+id/smsBody"
                    a:text="@string/sms_send_abbr"
                    a:enabled="false"/>
        </LinearLayout>
    </LinearLayout>

</RelativeLayout>

EditTextが1行以上に展開されると、ボタンも展開されることを除いて、正常に機能します。では、ボタンの高さを固定するにはどうすればよいですか?

4

1 に答える 1

1
 <Button
   a:layout_height="0dip" 

自動的にサイズ変更されることを意味します。wrap_content に設定してみてください

于 2012-07-19T17:36:51.833 に答える