2012年3月28日

利用Java反射技术阻止通过按钮关闭Android对话框

摘要: 众所周知,AlertDialog类用于显示对话框。关于AlertDialog的基本用法在这里就不详细介绍了,网上有很多,读者可以自己搜索。那么本文要介绍的是如何随心所欲地控制AlertDialog。 现在我们来看看第一个需求:如果某个应用需要弹出一个对话框。当单击“确定“按钮时完成某些工作,如果这些工作失败,对话框不能关闭。而当成功完成工作后,则关闭对话框。当然,无论何程度情况,单击“取消”按钮都会关闭对话框。 这个需求并不复杂,也并不过分(虽然我们可以自己弄个Activity来完成这个工作,也可在View上自己放按钮,但这显示有些大炮打蚊子了,如果对话框上只有一行文本,费这么多劲太不值... 阅读全文

posted @ 2012-03-28 16:20 飞鸟依然 阅读(431) 评论(0) 推荐(0)

Android中 AlertDialog 的使用

摘要: Android帮助文档中,我们看到关于AlertDialog类的第一段描述如下: A subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method. If you want to display a more complex view, look up the FrameLayout called "custom" and add your v 阅读全文

posted @ 2012-03-28 16:12 飞鸟依然 阅读(878) 评论(0) 推荐(1)

导航