首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

AlertDialog的有关问题

2012-12-14 
AlertDialog的问题我现在AlertDialog中,有三个EditViet.他们三个都不能为空.然后他们三个我都用了setError

AlertDialog的问题
我现在AlertDialog中,有三个EditViet.他们三个都不能为空.
然后他们三个我都用了setError的方法提示.
但是每次我按了确定,然后对话框就消失了.这个问题怎么解决.
我想在其中一个为空的时候,点了确定,对话框还不消失,应该怎么解决呢?
[最优解释]


 new AlertDialog.Builder(this).setPositiveButton("a",
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        try {
                            Field f = dialog.getClass().getSuperclass()
                                    .getDeclaredField("mShowing");
                            f.setAccessible(true);
                            f.set(dialog, false);// 不关闭
                            // f.set(dialog, true);关闭
                        }
                        catch(Exception e) {
                            // TODO: handle exception
                        }
                    }
                }).show();

[其他解释]
2楼正解,印象中只有这种方法改变下属性才可以
[其他解释]
引用:
2楼正解,印象中只有这种方法改变下属性才可以

俺是1楼,你才是二楼
[其他解释]
引用:
引用:2楼正解,印象中只有这种方法改变下属性才可以
俺是1楼,你才是二楼

呵呵 打错了,抱歉 
[其他解释]
这是用的反射?
[其他解释]
引用:
这是用的反射?

这段代码也是百度的


不过LZ该结贴了,不喜欢提了问不接贴的人,搞得都木有回答问题的欲望了

热点排行