2013-11-28 2 views
1

내 사용자 정의 ProgressBar에 이상한 동작이 있습니다. 안드로이드에서 < 4.4, 좋은 결과를 얻을. 다음과 같이 Android 4.4의 사용자 정의 ProgressBar의 인공물

그리고 내 사용자 지정 ProgressBar 클래스

<?xml version="1.0" encoding="utf-8"?> 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > 

<item android:id="@android:id/background"> 
    <clip> 
     <shape> 
      <corners android:radius="0dip" /> 

      <gradient 
       android:angle="90" 
       android:centerColor="#004676" 
       android:centerY="0.75" 
       android:startColor="#004676" /> 
     </shape> 
    </clip> 
</item> 
<item android:id="@android:id/progress"> 
    <clip> 
     <shape> 
      <corners android:radius="0dip" /> 

      <gradient 
       android:angle="90" 
       android:endColor="#ee7407" 
       android:startColor="#ee7407" /> 
     </shape> 
    </clip> 
</item> 
, 나는 그것을 정의 :

색상이 여기에 정의되어있다 : 그러나 안드로이드 4.4에, 나는 ProgressBar 동안 유물이 감소 얻을

private void init() { 

    this.setMax(MAX); 
    this.setProgress(MAX); 
    _timer = new CountDownTimer(TIME * 1000, 100) { 

     public void onTick(long millisUntilFinished) { 
      decreaseProgress(); 
     } 

     public void onFinish() { 
      finished(); 
     } 
    }; 
} 


private void decreaseProgress() { 
    this.setProgress(this.getProgress() - 1); 
} 

Progress upper

누구도 나를위한 힌트를 가지고 있습니까? 미리 감사드립니다!

답변

2

나는 정확히 넥서스에서 동일한 문제가 발생했습니다 5.

현재 내가 소스 코드에 파고의 차이를 찾을 시간이 없다,하지만 난 당신이 당신의 진행률 표시 줄을 무효화하면 가능이 문제를 억제하는 것으로 진행 상황을 설정 한 후 매번 상황에

, 그것은해야한다 :이 도움이 될 수

private void decreaseProgress() { 
    this.setProgress(this.getProgress() - 1); 
    this.postInvalidate(); 
} 

희망!

+0

이 (가) 시도해 보겠습니다. –

+1

이것은 수정 프로그램이었습니다. 고마워요. 하지만 이제 4.4.2에 대한 업데이트가 있습니다. postInvalidate()가 없으면 더 이상 발생하지 않습니다. Preograssbar 자체의 버그처럼 보입니다. –

+0

@ A.S. 업데이트 해 주셔서 감사합니다. 이제 invalidate()도 제거 할 수 있습니다! – Joseph