How to change android indeterminate ProgressBar color?

前端 未结 8 1063
春和景丽
春和景丽 2020-12-02 06:12

I would like to know how I can change indeterminate ProgressBar color from basis white/grey color to black ? When I change the indeterminateDrawable

8条回答
  •  执念已碎
    2020-12-02 06:31

    I see other answers are quite old, in order to change the indeterminate ProgressBar color you have just to set android:indeterminateTint and android:indeterminateTintMode attributes in your ProgressBar item directly in XML:

    
    

    android:indeterminateTint - Tint to apply to the indeterminate progress indicator.

    Must be a color value, in the form of "#rgb", "#argb", "#rrggbb", "#aarrggbb", or a reference to a resource @color/colorPrimary.

    android:indeterminateTintMode - Blending mode used to apply the progress indicator tint.

    Must be one of the following constant values:
    add, multiply, screen, src_atop, src_in or src_over

    Getter and Setter methods for these attributes are:

    • getIndeterminateTintList()
    • getIndeterminateTintMode()
    • setIndeterminateTintList(ColorStateList tint)
    • setIndeterminateTintMode(PorterDuff.Mode tintMode)

    All of them were added in API level 21

提交回复
热议问题