ListView是否可以在一个对话框中?

编程入门 行业动态 更新时间:2024-10-09 08:28:45
本文介绍了ListView是否可以在一个对话框中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 基本上,我有这个由[Fedor] [1]最初创建的LazyList,我只是想知道是否还有一个对话框。请帮助我,我一直在努力寻找几天,我真的需要你的帮助。感谢提前!

这里他的代码,当你需要它:

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/guide/topics/ui/dialogs.html

更新:

另一个解决方案可能是创建一个活动并将其放在其中,并将其主题作为对话框。

阅读此文来了解如何设置主题 developer.android/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={ "www.urlurl/hi.png", "www.urlurl/hi.png", }; }

解决方案

have a lokk at this.

developer.android/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 developer.android/guide/topics/ui/themes.html

更多推荐

ListView是否可以在一个对话框中?

本文发布于:2023-11-27 09:58:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637603.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对话框中   ListView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!