Я использую пользовательский диалог, который содержит текстовое поле, изображение и кнопку.Текст может содержать HTML.Иногда нижняя часть диалога отсекается от нижней части, когда текст достаточно длинный.Как я могу предотвратить это?Я хочу, чтобы Android определял размер диалога, но, похоже, он этого не делает.Нужно ли мне в этом случае самостоятельно настраивать размер Диалога?
Вот макет ...
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/alert_root_incorrect"
style="@style/AlertDialogTheme"
android:background="@drawable/rounded_alert"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/rounded_alert"
>
<TableLayout
android:stretchColumns="0"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TableRow>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:textStyle="bold"
android:text="Sorry, that's wrong!"
android:textColor="@color/gray_dark" />
<ImageView
android:id="@+id/check"
android:background="@drawable/xmark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="10dp" />
</TableRow>
</TableLayout>
<TextView
android:id="@+id/alert_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="none"
android:text="In fact, this is where the explanation will go. Something about how this passage related to the topic"
android:textColor="#000000" />
<Button
android:id="@+id/okay_button"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:background="@drawable/rounded_alert_button"
android:text="Okay"
android:textColor="@color/white"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
А вот код, который я использую для его загрузки ...
if ( null == layout ) {
this.layout = inflater.inflate(R.layout.alert_incorrect, (ViewGroup) findViewById(R.id.alert_root_incorrect));
}
TextView message = (TextView) layout.findViewById(R.id.alert_text);
message.setText(Html.fromHtml(card.getConclusion()));
((Button) layout.findViewById(R.id.okay_button)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
dismissDialog(INCORRECT_DIALOG);
nextQuestion();
}
});
layout.requestLayout();
dialog = new Dialog(this, R.style.AlertDialogTheme);
dialog.setContentView(layout);
dialog.setCancelable(false);
return dialog;
И вот несколько слов о том, что я имею в виду ..
Спасибо,
Джон