progress bar - Change drawables on Android ProgressBar -
progress bar - Change drawables on Android ProgressBar -
i've got progress_incomplete.xml , progress_complete.xml
both files (i removed gradients , stroke info save room not important).
basically incomplete.xml has yellowish colours , finish has greenish colours.
<?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> ... </shape> </item> <item android:id="@android:id/secondaryprogress"> <clip> <shape> ... </shape> </clip> </item> <item android:id="@android:id/progress" > <clip> <shape> ... </shape> </clip> </item> </layer-list>
in java file, have this:
if (percentage == 100) { // alter colour progressbar.setprogressdrawable(r.drawable.progress_complete); }
i'm finding isn't working though. i've tried setbackground , setbackgrounddrawable alter isn't taking effect.
what do?
thanks
if (percentage == 100) { // alter colour drawable drawable = getresources().getdrawable(r.drawable.progress_complete); progressbar.setprogressdrawable(drawable); }
android progress-bar
Comments
Post a Comment