如何更改ProgressDialog加载器(微调器)

你为什么不试试这个呢? 你可以实现你想要的

<进度栏
android:id =“ @ + id / ProgressBar01”
android:layout_width =“ wrap_content”
style =“?android:attr / progressBarStyleLarge”
android:layout_height =“ wrap_content”
android:indeterminateDrawable =“ @ drawable / mmm”
android:background =“ @ xml / progress” />

drawable中的mmm.xml文件在哪里

<rotate xmlns:android =“ http://schemas.android.com/apk/res/android”
android:pivotX =“ 50%”
android:pivotY =“ 50%”
android:fromDegrees =“ 0”
android:toDegrees =“ 360”>
<shape android:shape =“ ring”
android:innerRadiusRatio =“ 3”
android:thicknessRatio =“ 8”
android:useLevel =“ false”>

您可以通过扩展progressbar类来真正创建一些很棒的自定义进度栏

祝一切顺利

xmllayot:


< ?xml版本=“ 1.0”编码=“ utf-8”?>
http://schemas.android.com/apk/res/android&quot ;
android:id =“ @ + id / container”>

android:layout_width =“ match_parent”
android:layout_height =“ match_parent”>
//您在这里的内容

< 进度栏
android:id =“ @ + id / progressBar”
style =“?android:attr / progressBarStyleLarge”
android:layout_width =“ wrap_content”
android:layout_height =“ wrap_content”
android:layout_centerHorizo​​ntal =“ true”
android:layout_centerVertical =“ true”
android:visibility =“ gone”
android:indeterminateDrawable =“ @ drawable / progress”>


主要活动:


公共类YourActivity扩展了活动{

私人ProgressBar酒吧;

@Override
受保护的void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.layout);
bar =(ProgressBar)this.findViewById(R.id.progressBar);
新的ProgressTask()。execute();
}
私有类ProgressTask扩展了AsyncTask {
@Override
受保护的void onPreExecute(){
bar.setVisibility(View.VISIBLE);
}

@Override
保护的void doInBackground(Void…arg0){
//我的东西在这里
}

@Override
受保护的void onPostExecute(无效结果){
bar.setVisibility(View.GONE);
}
}
}


drawablw / progress.xml


< ?xml版本=“ 1.0”编码=“ utf-8”?>

< !–
持续时间= 1表示一轮将在1秒内完成。 别管它。
如果要加快旋转速度,请增加持续时间值。
在示例1080中,旋转速度快了三倍。
将值乘以360,否则圆环会显得笨拙
–>
http://schemas.android.com/apk/res/android&quot ;
android:fromDegrees =“ 0”
android:pivotX =“ 50%”
android:pivotY =“ 50%”
android:duration =“ 1”
android:toDegrees =“ 360”>

< 形状
android:innerRadiusRatio =“ 3”
android:shape =“ ring”
android:thicknessRatio =“ 8”
android:useLevel =“ false”>
< 尺寸
android:height =“ 48dip”
android:width =“ 48dip” />

< 渐变
android:centerColor =“ @ color / color_preloader_center”
android:centerY =“ 0.50”
android:endColor =“ @ color / color_preloader_end”
android:startColor =“ @ color / color_preloader_start”
android:type =“ sweep”
android:useLevel =“ false” />