0

私のアプリには、LinearLayoutに1つのEditTextとImageButtonがあります。

ImageButtonであるlayout_heightEditTextを設定したいと思います。

ImageButtonにはsrc画像があり、setlayout_heightはwrap_contentです。

EditTextのlayout_heightと同じImagebuttonのsrcにどのように設定しますか?

4

2 に答える 2

1

配置が水平であれば解決策になります

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

        <EditText
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="5"/>

        <ImageButton 
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="5"
            android:src="@drawable/mail"/>


    </LinearLayout>

ここに画像の説明を入力してください

于 2013-03-26T04:59:02.730 に答える
0

何をしようとしているのかについては、線形レイアウトをlayout_widthとlayout_height "wrap_content"に設定し、ImageViewを両方ともwrap_contentに設定してから、editTextのlayout_heightをmatch_parentに設定すると、ImageViewと同じになると思います。

私の悪い私はあなたがImageViewを言ったと思った私は間違っている可能性があります

于 2013-03-26T04:10:23.453 に答える