材料设计progressdialog [英] Material Design progressdialog

查看:192
本文介绍了材料设计progressdialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 alertDialog = new ProgressDialog(this);                          
 alertDialog.setMessage(getResources().getString(R.string.loader));
 alertDialog.setCancelable(false);
 alertDialog.show();

简单,当我做到这一点,绿色的圆圈显示了除它以外的字加载。然而,当我不使用进度对话框,我用的是页面上的进度,我得到,因为我有我的styles.xml定义的下方的粉红色

Simply when I do this, green circle shows up with the word loading besides it. However when i DONT USE progress dialog, and i use a progressbar on the page I get a pink color as i have defined the below in my styles.xml

<item name="colorPrimary">@color/pink</item>
<item name="colorPrimaryDark">@color/pink</item>
<item name="colorAccent">@color/pink</item>

什么是越来越圆粉红色的页面上的进度条的解决方案?

What is the solution of getting the circle pink color as in the progress bar on page?

推荐答案

有关API 21+您可以定义以下样式到颜色的物质进步对话框。请注意,这应该是在值-V21 ,如果你支持较低的平台。

For API 21+ you can define the following style to colour the material progress dialog. Note that this should be under values-v21 if you support lower platforms.

<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:alertDialogTheme">@style/MyAlertDialog</item>
</style>

<style name="MyAlertDialog" parent="android:Theme.Material.Light.Dialog.Alert">
    <item name="android:colorAccent">@color/pink</item>
</style>

&LT;项目名称=colorAccent&GT; 是AppCompat而&LT;项目名称=机器人:colorAccent&GT; 是API 21+。材质进程对话,不与AppCompat工作,即使有新的 v22.1 支持lib中的 AppCompatDialog

<item name="colorAccent"> is for AppCompat whereas <item name="android:colorAccent"> is for API 21+. Material progress dialogs don't work with AppCompat, even with the new v22.1 Support lib AppCompatDialog.

您可以看到克里斯·巴内斯'答案的这里说他不会的backport进程对话,因为他们是错误的思路。

You can see Chris Banes' answer here stating that he will not backport Progress Dialogs because they are "a bad pattern".

这篇关于材料设计progressdialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆