Я использую действие с android: theme = "@ android: style / Theme.Dialog", чтобы оно действовало как диалог. Что ближе всего к поведению native диалогов: должен ли диалог заполнять экран (по ширине) или нет? И должен ли он расти динамически, если, например, текстовое поле заполняется вводом?
Я догадываюсь, что диалог не должен заполнять экран. Я пытался добиться такого поведения, но что бы я ни делал, в Android 2.2 ширина диалога , кажется, заполняет родительский .
Мой макет xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/text" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:autoText="true"
android:text="@string/item_delete_dialog_label"
android:padding="5dip" />
<LinearLayout android:layout_height="wrap_content"
android:orientation="horizontal"
style="@android:style/ButtonBar" android:layout_width="fill_parent">
<Button android:id="@+id/yes" android:layout_height="wrap_content"
android:text="@string/button_yes"
android:layout_width="wrap_content"
android:layout_weight="1"/>
<Button android:id="@+id/no" android:layout_height="wrap_content"
android:text="@string/button_no"
android:layout_width="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
Я нашел много вопросов о том, как заставить диалоговое окно заполнить экран по ширине, но ни одного о том, чтобы сделать его оборачиваемым по ширине. Как я могу получить это?