次の内容の XML を作成する必要があります
。
* 2 つの TextViews の右側にある 1 つの ImageView。垂直方向に中央揃え、30x30 ピクセル。
主な制限の 1 つは、PopupWindow に膨張させたときに画面全体を使用できないことです。つまり、多くの場所で属性 fill_parent を使用できません。
私は多くの異なるレイアウトを試しましたが、テキストが長い場合、ImageView は TextViews によって押しのけられ続けます。テキストが「半分の長さ」の場合、画像は小さくなりますが、それでも表示されます。常に 30x30 ピクセルにしたいので、テキストを折り返して代わりに別の行を使用できます。
width と minWidth の値を指定しようとしました。ImageView の layout_weight="1" も試しました。また、ImageView を LinearLayout にラップして、layout_weight="1" パラメータを指定してみました。何も機能しません。
機能していないものの例を次に示します。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:orientation="vertical">
<TextView android:id="@+id/popupTitle" android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/popupContent"
android:layout_width="wrap_content" android:layout_height="wrap_content"/>
</LinearLayout>
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/img_30x30_px" />
</LinearLayout>