앱에서 진행율에 따른 ProgressBar의 색상을 변경을 해야 하는대
도무지 방법을 찾을수가 없네요...LevelListDrawable 을 이용해서 해보려고 시도 하고 있는대 잘 안되네요...
levellist.xml 파일을 만들어서 아래와 같이 넣었구여
<?xml version="1.0" encoding="utf-8"?>
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:maxLevel="0" android:drawable="@drawable/progressbar_custom_0"/>
<item android:maxLevel="1" android:drawable="@drawable/progressbar_custom_1"/>
<item android:maxLevel="2" android:drawable="@drawable/progressbar_custom_2"/>
<item android:maxLevel="3" android:drawable="@drawable/progressbar_custom_3"/>
<item android:maxLevel="4" android:drawable="@drawable/progressbar_custom_4"/>
</level-list>
progressbar_custom_0.xml 에는 이렇게 넣었구여 다른 progressbar_custom_1, progressbar_custom_2 이런 파일은 내용은 같고 색상만
변경해서 넣었습니다.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#ff9d9e9d"
android:centerColor="#ff5a5d5a" android:centerY="0.75"
android:endColor="#ff747674" android:angle="270" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#80ffd300"
android:centerColor="#80ffb600" android:centerY="0.75"
android:endColor="#a0ffcb00" android:angle="270" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="5dip" />
<gradient android:startColor="#1472ad" android:centerColor="#5e9ef3"
android:centerY="0.75" android:endColor="#79abec" android:angle="270" />
<stroke android:width="3dp" color="#000000" />
<padding android:left="10dp" android:top="10dp"
android:right="10dp" android:bottom="10dp" />
</shape>
</clip>
</item>
</layer-list>
progressbar의 android:progressDrawable 에 위에 만든 levellist 를 바인딩 해줬습니다.
이렇게 하고 돌리니 progress가 1이 되면 그냥 없어지네요...ㅡㅡ;;;
혹시 도움을 주실분 계신가요???