Reputation: 633
With CardView as root layout in xml file(for a custom view), i get an error from android studio-
Missing styles. Is the correct theme chosen for this layout? Use the Theme combo box above the layout to choose a different layout, or fix the theme style references. Failed to find style with id 0x7fff000e in current theme .
I tried choosing different themes for the layout, none worked it seems.
I am using the new appCompatActivity in my app.
any theme works fine with the old ActionBarActivity.
Upvotes: 5
Views: 1946
Reputation: 1
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="120sp"
android:layout_marginStart="20sp"
android:layout_marginTop="20sp"
android:layout_marginEnd="20sp"
app:cardCornerRadius="8sp">
</androidx.cardview.widget.CardView>
check out here https://codingtemplates.com/how-to-make-cardview-in-android-studio
Upvotes: 0
Reputation: 183
I guess this is a bit ate for your question but just in case someone needs it:
Mine was solved after restarting android studio using the below option:
File -> Invalidate Caches/Restart...
Upvotes: 3
Reputation: 31
Adding the elements below to the AppTheme helped me to solve a similar problem
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
Upvotes: 3