ImageButton: принудительно квадратная иконка (высота = WRAP_CONTENT, ширина = ?)

В моем горизонтальном LinearLayout у меня есть TextEdit и ImageButton. ImageButton такой же высокий, как TextEdit.

Мне бы хотелось, чтобы ширина ImageButton была ровно такой же, как и длина.

На данный момент ширина ImageButton выглядит так, как если бы не было масштабирования (ширина ImageButton [px] = немасштабируемая ширина отрисовки [px]):

example

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

    <EditText
        android:id="@+id/txtName"
        android:layout_width="1dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <ImageButton
        android:id="@+id/btSet"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:scaleType="fitEnd"
        android:src="@drawable/pin2" />

</LinearLayout>

Как это должно выглядеть:

objective

8
задан SecStone 24 March 2012 в 15:08
поделиться