2011-12-21 85 views
3

我正在使用进度加载器使用ProgressDialog和组件。 都是相似的类型和黑色我想改变装载机。 From this loader如何自定义进度加载器?

,而不是这种进步,我需要一个新的类似于下一个

Expected progress loader

+0

但接下来的时间,创造一个更美好搜索:P – 2011-12-21 13:40:07

+0

这一个我已经使用,有一个看起来不像加载程序的问题。每轮旋转都会暂停。而不是这个360旋转的动画没有其他的去? – arnp 2011-12-21 13:59:51

+0

在对话框中尝试使用上升的线程优先级,使用:Thread.currentThread()。setPriority(Thread.MAX_PRIORITY); – 2011-12-22 07:14:32

回答

5

我用这个像你

Dialog dialog = new Dialog(context,R.style.LoadingDialogTheme); 
    dialog.setContentView(R.layout.loading); 
    dialog.setCancelable(false); 
    dialog.show(); 
    dialog.findViewById(R.id.loading_icon).startAnimation(AnimationUtils.loadAnimation(InitActivity.this, R.anim.rotate360)); 
    } 

/RES /动画/ rotate360负载。 xml

<?xml version="1.0" encoding="UTF-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android"> 
    <rotate 
     android:fromDegrees="0" 
     android:toDegrees="360" 
     android:pivotX="50%" 
     android:pivotY="50%" 
     android:duration="2000" 
     android:repeatCount="infinite" /> 
</set> 

/res/layout/loading.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:gravity="center" 
    android:background="@color/loadingBackground"> 
    <ImageView 
    android:id="@+id/loading_icon" 
    android:gravity="center" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/ic_loading"/> 
    <TextView 
    android:id="@+id/loading_text" 
    android:layout_gravity="center" 
    android:text="Loading" 
    android:gravity="center" 
    android:textSize="18dip" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:paddingTop="3dip" 
    android:textColor="@color/info" 
    android:layout_below="@+id/loading_icon"/> 
</TextView> 

那么你必须做的是让你的礼物的一帧,并使用它像loading_icon.png

祝你工作:)