Styling progress dialog in android

白昼怎懂夜的黑 提交于 2020-01-06 12:42:55

问题


Spent half day to understand how to change some styles to progress dialog , but I am not able to do so.

Very simple thing I wanted to start with, change the spinner color in progress dialog to some other color other than white ! , Got stuck here itself.

In Android SDK , they are using some image and applying animation to it , I will have to do everything from scratch to change the color of the spinner ?

Any good examples where progress dialog has been modified would be helpful , I have seen in documentation , google search results upto 4-6 pages :) , still not able to get it.

Any interesting way to show progress dialog other than default one ?

I would appreciate if someone can provide good blog on Applying themes and styles , which explains in detail.

Some code which I am using,

dialog1 = new ProgressDialog(this);      
dialog1 = ProgressDialog.show(this, "", "Loading. Please wait...", true);

Trying to do lot with dialog1, but not getting any desired result.

Thank you


回答1:


final ProgressDialog progressBar = ProgressDialog.show(
                            SearchScreen.this, "", progressbarSearching);
                    progressBar.setIndeterminate(true);

                    progressBar.setIndeterminateDrawable(getResources()
                            .getDrawable(R.anim.progressbar_handler));

progressbar_handler.xml

<shape android:shape="ring" android:innerRadiusRatio="3"
    android:thicknessRatio="8" android:useLevel="false">

    <size android:width="48dip" android:height="48dip" />

    <gradient android:type="sweep" android:useLevel="false"
        android:startColor="#4c737373" android:centerColor="#4c737373"
        android:centerY="0.50" android:endColor="#FF0000" />

</shape>



来源:https://stackoverflow.com/questions/4908289/styling-progress-dialog-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!