mpb_progressBackgroundTint no work ?
trycatchx opened this issue · 4 comments
I am using follow code,and i set mpb_progressBackgroundTint
to black . and it no work for me?
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:layout_below="@+id/head"
android:id="@+id/test"
android:layout_width="match_parent"
android:layout_height="10dp"
android:indeterminate="true"
lib:mpb_progressStyle="horizontal"
lib:mpb_indeterminateTint="@color/main_green"
lib:mpb_progressBackgroundTint="@color/black"
lib:mpb_showProgressBackground="true"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal" />
Yes, this is by design because it's the behavior of framework ProgressBar
— You can only have one tint that applies to the whole drawable when indeterminate (which is android:indeterminateTint
), and the implementation of an indeterminate drawable is also not a LayerDrawable
(unlike the case of a progress drawable, which is also the framework behavior), making it even harder to do so. Do you really need to set a different tint for progress backgrouond?
@DreaminginCodeZH thx ! It's not necessary, i set mpb_showProgressBackground = “false”
to fulfil my requirements. however, if i want to set a different tint for progress backgrouond really ,what should i do?
You'll need to modify the indeterminate drawable to accept another tint for progress background, and expose that (by getting the drawable instance and setting it, or exposing it on MaterialProgressBar)
@DreaminginCodeZH thx ! i got it .