How to change android indeterminate ProgressBar color?

前端 未结 8 1034
春和景丽
春和景丽 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:45

    actually all u need to do (for both cirle and bar) is create an xml file in drawable as shown below...... progress_spinner_001 points to whatever image u want to animate and duration ... how long u want to display each frame for....... and set ur android:indeterminateDrawable= filename_in_drawable....

    <?xml version="1.0" encoding="utf-8"?>
    <animation-list
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:oneshot="false">
    <item android:drawable="@drawable/progress_spinner_001" android:duration="300" />
    <item android:drawable="@drawable/progress_spinner_002" android:duration="300" />
    <item android:drawable="@drawable/progress_spinner_003" android:duration="300" />
      <item android:drawable="@drawable/progress_spinner_004" android:duration="300" />
        <item android:drawable="@drawable/progress_spinner_005" android:duration="300" />
          <item android:drawable="@drawable/progress_spinner_006" android:duration="300" />
         <item android:drawable="@drawable/progress_spinner_007" android:duration="300" />
        <item android:drawable="@drawable/progress_spinner_008" android:duration="300" />
    </animation-list>
    

    ps u may need to resize the progressbar to show as desired

    0 讨论(0)
  • 2020-12-02 06:52

    Override android:colorControlActivated in your AppTheme which should be in your styles.xml:

    <style name="AppTheme" parent="...">
        ...
        <item name="android:colorControlActivated">@color/beautiful_color</item>
        ...
    </style>
    

    Works on API 21+

    0 讨论(0)
提交回复
热议问题