ListView是否可以在一个对话框中? [英] Is it possible to have ListView inside a dialog?
问题描述
这里他的代码,当你需要它:
p
list.setOnItemClickListener(new OnItemClickListener(){
public void onItemClick(AdapterView<?> arg0,查看arg1,int position,long id){
if(position == 0){
final Dialog dialog = new Dialog(MainPictures.this,R.style.CustomDialogTheme );
dialog.setContentView(R.layout.customlayout);
dialog.setTitle(null);
dialog.setCancelable(true);
dialog.show();
WindowManager.LayoutParams lp = dialog.getWindow()。getAttributes();
lp.dimAmount = 0.5f;
dialog.getWindow()。setAttributes(lp);
对话框。 getWindow()。addFlags(WindowManager.LayoutPar ams.FLAG_BLUR_BEHIND);
}
else {
System.out.println(错误);
}
}
});
}
私人字符串[] mStrings = {
http://www.urlurl/hi.png,
http://www.urlurl/hi.png,
};
}
有一个lokk在这。
http:// developer.android.com/guide/topics/ui/dialogs.html
更新:
另一个解决方案可能是创建一个活动并将其放在其中,并将其主题作为对话框。
阅读此文来了解如何设置主题 http://developer.android.com/guide/topics/ui/themes.html
Basically, I have this LazyList which originally created by [Fedor][1] , I am just wondering if there is anyway to put it inside a dialog. Please help me, I've been struggling for days trying to figure this out, I really need your help. Thanks in advance!
Here his code when you need it:
p
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> arg0, View arg1, int position,long id) {
if(position == 0){
final Dialog dialog = new Dialog(MainPictures.this, R.style.CustomDialogTheme);
dialog.setContentView(R.layout.customlayout);
dialog.setTitle(null);
dialog.setCancelable(true);
dialog.show();
WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
lp.dimAmount=0.5f;
dialog.getWindow().setAttributes(lp);
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
else {
System.out.println("Error");
}
}
});
}
private String[] mStrings={
"http://www.urlurl/hi.png",
"http://www.urlurl/hi.png",
};
}
have a lokk at this.
http://developer.android.com/guide/topics/ui/dialogs.html
Update:
Another solution could be Create an ACtivity and Put listView in it and make its Theme as Dialog.
read this to know how to set theme http://developer.android.com/guide/topics/ui/themes.html
这篇关于ListView是否可以在一个对话框中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!