AlertDialog 的文本和宽度太大
我使用的是 Android 2.3
我的应用程序中有一个警报对话框。这里是代码:
final CharSequence[] items = { "Entfernen", "Auswählen",
"Editieren", "Zurücksetzen", "Abbrechen" };
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(productName);
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {...}
我有一个奇怪的问题:对话框总是填充我的显示器的整个宽度。因此选择器的文本非常大。 我怎样才能限制这个?该对话框的文本大小或宽度...
I am using Android 2.3
I have an alertdialog in my app. Here the code:
final CharSequence[] items = { "Entfernen", "Auswählen",
"Editieren", "Zurücksetzen", "Abbrechen" };
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(productName);
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {...}
I have a strange problem: The Dialog always fills the whole width of my display. And therefore the text of the selectors is very large.
How can I limit this? Either textsize or width of this dialog...
您可以调用警报对话框的以下方法将自定义 xml 填充到警报对话框中。
调用此函数后,您需要设置 TextView/ImageView 变量,就像处理活动一样。
如需更好的示例,请查看 Android API 文档。
http://developer.android.com/guide/topics/ui/dialogs .html#CustomDialog
You can call the following method of your alert dialog to inflate a custom xml into your alert dialog.
After calling this, you would need to set TextView/ImageView variables, just like how you would with activities.
For a better example, check out Android API Docs.
http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog