2011-12-21 83 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

祝你工作:)