Reputation: 9574
I want to add two styles in ProgressBar
Here is the xml for ProgressBar
<ProgressBar
style="?android:attr/progressBarStyle"
android:visibility="gone"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/progressBar"
android:layout_marginTop="@dimen/margin_xxlarge_xxl"/>
I have a style defined in res/values/styles.xml
<style name="genericRegView">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">@dimen/margin_xxlarge_xxl</item>
</style>
I want to apply genericRegView
to ProgressBar
but as you can see the it already has a style attached with it. How can I add both?
I know I can inherit styles through names in my style XML
files but ProgressBar
style is ?android:attr/progressBarStyle
so I don't know how to inherit it
Upvotes: 1
Views: 50
Reputation: 40830
You can inherit the ProgressBar
style using parent
attribute
<style name="genericRegView" parent="Widget.AppCompat.ProgressBar">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">@dimen/margin_xxlarge_xxl</item>
</style>
And apply the genericRegView
style to the ProgressBar
Upvotes: 1