Reputation: 494
I'm trying to apply a theme to all of the progress bars in my application. In the manifest, I apply a custom theme called AppTheme
. Within this style, I add an additional progressBarStyle
item like so:
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
...
<item name="android:progressBarStyle">@style/my_progress_bar</item>
</style>
And I define the custom bar progress style as such:
<style name="my_progress_bar" parent="Base.Widget.AppCompat.ProgressBar">
<item name="android:indeterminateTint">@color/app_black</item>
<item name="android:indeterminateTintMode">src_in</item>
</style>
If I apply this style to individual ProgressBar views, it works, but I want to apply it in my manifest through the AppTheme so that I don't have to specify the same tint and tintMode for every progress bar across the app. I am using a device running API 25.
What am I doing wrong? Thanks for any insight.
Edit: after further investigation, for some reason adding the style to the AppTheme doesn't propagate through to the manifest. If I replace the AppTheme with my progress bar style entirely, it works. But I still need the styles defined in AppTheme
.
this works:
<application ...
android:theme="@style/my_progress_bar">
but this does not:
<application ...
android:theme="@style/AppTheme">
What's interesting is that if I remove everything in AppTheme except for the progress bar styling I define, it doesn't work. Is there a bug with nested styles in android? My manifest doesn't see the progressBarStyle defined when I just pass it this AppTheme:
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:progressBarStyle">@style/my_progress_bar</item>
</style>
Upvotes: 1
Views: 347
Reputation: 2789
In your manifest file, you have the following:
<application
android:name="app"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
.......
</application>
add the following to your AppTheme within your style.xml file:
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!--This will change the color of your progress bar throughout the whole app-->
<item name="colorControlActivated">@color/app_black</item>
</style>
Upvotes: 1