如何删除列表中的android警报对话框额外的空间 [英] how to remove extra space in android list alert dialog
本文介绍了如何删除列表中的android警报对话框额外的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图显示与单一选择的项目样本警告对话框,并与面临的问题
列表结束后额外的空间。
I am trying to display sample alert dialog with single choice items and facing problem with extra space after end of the list.
下面是我的code
final CharSequence[] items = {"Red", "Green", "Blue"};
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Pick a color");
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(context, items[item], Toast.LENGTH_SHORT).show();
}
});
AlertDialog alert = builder.create();
alert.show();
建议我解决这个问题。
推荐答案
您可以拥有自己的对话框布局(见文档),但我会建议离开它是,因为这个对话框将另眼相看的HC / ICS / JB,所以调整其外观是相当糟糕的主意作为Android的其它版本也可能有所不同。这只是OS做它的方式。离开它是我的忠告。
You can have your own dialog layout (see docs), but I'd suggest to leave it as is, as this dialog will look differently on HC/ICS/JB, so tweaking its look is quite bad idea as on other versions of android it may look different. It's just the way OS does it. Leave it is my advice.
这篇关于如何删除列表中的android警报对话框额外的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文