android之修改系统自带ProgressDialog样式
1.ProgressDialog默认样式是当前Activity的theme所定义的ProgressDialog样式。
继承自父类AlertDialog的style.
AlertDialog的源码
static int resolveDialogTheme(Context context, int resid) { if (resid == THEME_TRADITIONAL) { return com.android.internal.R.style.Theme_Dialog_Alert; } else if (resid == THEME_HOLO_DARK) { return com.android.internal.R.style.Theme_Holo_Dialog_Alert; } else if (resid == THEME_HOLO_LIGHT) { return com.android.internal.R.style.Theme_Holo_Light_Dialog_Alert; } else if (resid == THEME_DEVICE_DEFAULT_DARK) { return com.android.internal.R.style.Theme_DeviceDefault_Dialog_Alert; } else if (resid == THEME_DEVICE_DEFAULT_LIGHT) { return com.android.internal.R.style.Theme_DeviceDefault_Light_Dialog_Alert; } else if (resid >= 0x01000000) { // start of real resource IDs. return resid; } else { TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(com.android.internal.R.attr.alertDialogTheme, outValue, true); return outValue.resourceId; } }
2.引用系统的样式,引用不到com.android.internal.R.style.Theme_Holo_Dialog_Alert,而是通过ProgressDialog.THEME_HOLO_LIGHT来引用系统自定义ProgressDialog样式。
ProgressDialog dialog = new ProgressDialog(this, ProgressDialog.THEME_HOLO_LIGHT);
dialog.setTitle("登录");
dialog.setMessage("正在登录,请稍后...");
// dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCanceledOnTouchOutside(false);
dialog.setCancelable(true);
dialog.show();
3.引用自定义ProgressDialog样式
转自http://www.2cto.com/kf/201309/241455.html
转自http://blog.csdn.net/rohsuton/article/details/7518031
转自http://blog.csdn.net/luhuajcdd/article/details/8986212
转自http://blog.csdn.net/qjlhlh/article/details/7979179
更多相关文章
- 【Android(安卓)Native Code开发系列】三 Android源码的编译环境
- Windows下载Android全部源码
- 使用系统资源的引用总结以及收到短信后给一个notification提示
- Android系统的开机画面显示过程分析(4)
- Android系统设置---android.provider.Settings
- android调用系统的相机服务
- Android(安卓)EditText样式
- android 调用系统相机,预置路径,解决小米等机型uri返回为null的问
- Android系统源代码情景分析:基础知识