2013-06-20 69 views
1

想要使用像谷歌Play商店進度條。ProgressBar:不確定+顯示進度(如谷歌Play商店)

首先它(進度條)是不確定的 - 它顯示爲一個不斷移動的加載。然後它顯示進度 - 從0到100

在我的情況下,欄只顯示不確定或進度 - 取決於xml-config。 有什麼建議嗎?

我的進度條: 這裏的酒吧顯示短時間內移動的負載。當下載開始時進度條自己消失了。 沒有android:indeterminate =「true」沒有不確定性,只顯示進度條。 Progress我更改progress.setProgress((int)_self.currentProgress);

<ProgressBar 
       android:id="@+id/progress" 
       android:indeterminate="true" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:layout_marginTop="5dip" 
       style="@style/ProgressBarHoloHorizontal"/> 

風格:

<style name="ProgressBarHoloHorizontal"> 
    <item name="android:indeterminateOnly">false</item> 
    <item name="android:indeterminateDrawable">@drawable/progress_indeterminate_horizontal_holo</item> 
    <item name="android:minHeight">16dip</item> 
    <item name="android:maxHeight">16dip</item> 
    <item name="android:progressDrawable">@drawable/progress_horizontal_holo_light</item> 
</style> 
+2

當你設置你的進度進度不確定狀態應該dissapear,如果不只需輸入'progress.setIndeterminate(false);'當你得到你的第一個進展。 – zozelfelfo

+0

謝謝,@zozelfelfo!正確的解決方案 – vsvydenko

回答

1

使用progress.setIndeterminate(假)從不確定變爲確定進度條

+0

如前所述(請參閱@zozelfelfo評論)progress.setIndeterminate(false)應該添加到位,當您獲得第一個進度 – vsvydenko