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

android源码解析-AlertDialog及AlertDialog.Builder

2012-11-26 
android源码解析--AlertDialog及AlertDialog.Builder昨天3点睡的,今天8点起,竟然不是太困,我现在睡眠质量

android源码解析--AlertDialog及AlertDialog.Builder

   昨天3点睡的,今天8点起,竟然不是太困,我现在睡眠质量太好了吗?但是头稍微有点沉,今天突然阴天,感觉有些不爽,昨天收拾衣服时突然发现,少了一件衬衫,有点纳闷。

昨天晚上弄到很晚,简单的看了下Dialog的源码,说要分析下建造者模式,在dialog里面的应用其实是在AlertDialog中。

按照惯例,先看类说明:

else {            TypedValue outValue = new TypedValue();            context.getTheme().resolveAttribute(com.android.internal.R.attr.alertDialogTheme,                    outValue, true);            return outValue.resourceId;        }
alwaysReadCloseOnTouchAttr是一个抽象方法,然后初始化AlertController。在第四个构造方法中,加了一个是否可以取消和CancelListener回调监听。

        /**         * Creates a {@link AlertDialog} with the arguments supplied to this builder and         * {@link Dialog#show()}'s the dialog.         */        public AlertDialog show() {            AlertDialog dialog = create();            dialog.show();            return dialog;        }    }



查看更多源码内容:Android源码解析!

热点排行