Is there a way to apply a theme to a Cardview? I don't want to apply the style to every single view i'm creating.
This is my CardView right now:
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Custom.Widget.CardView">
<-- I don't want to define the style every time -->
</android.support.v7.widget.CardView>
And my styles.xml
<style name="Custom.Widget.CardView" parent="CardView">
<item name="cardBackgroundColor">@color/card_backgroundColor</item>
<item name="cardCornerRadius">12dp</item>
<item name="cardUseCompatPadding">true</item>
<item name="contentPadding">4dp</item>
</style>
I would like to add the style to themes.xml so that it will be applied to every Cardview, but I don't know how. Is it even possible for views from the support library?
When I add the following to themes.xml I get a warning: no resource found that matches the given name: attr 'Cardview'
<item name="Cardview">@style/Custom.Widget.CardView</item>