android progressdialog 样式,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 progressdialog 样式,android之修改系统自带ProgressDialog样式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 蓝牙版本avrcp怎么选_500元内无线
- 下一篇: js整体缩小网页_妙用JavaScrip