1
Using in activities the elevation works normally, after I put in Fragments, it became "flat".
1
Using in activities the elevation works normally, after I put in Fragments, it became "flat".
-1
It looks like a margin problem / fill, try to set the cardUseCompatPadding attribute to true. For example:
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="6dp"
card_view:cardUseCompatPadding="true"
card_view:cardElevation="4dp"
card_view:cardCornerRadius="3dp">
Explanation of Android doc:
Cardview adds additional padding to draw shadows on platforms before L.
This can cause Cards to have different sizes between L and before L. If you need to align Cardview with other views, you may need features specific dimension version of the API to explain the changes. Alternatively, you can set the cardUseCompatPadding flag to true and Cardview will add the same fill values on L platforms and then.
Since the creation of the cardUseCompatPadding flag the truth adds unnecessary gaps in the user interface, the default value is false.
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.
I don’t know if it makes much sense, but it might be a bug from
CardView
. The xml you put is the same in both?– Wakim
yes, it’s identical, there’s nothing different, until I tried to change the properties to see if it solves but it didn’t solve.
– Marcos Vinícius
He even tried the property
cardElevation
? You could put the XML fromFragment
and ofActivity
of it as a whole?– Wakim
I already used cardElevation and did not help. I did not understand this second part
– Marcos Vinícius
You have to see how is calling type, android:cardElevation app:cardElevarion cardview:cardElevation
– Alessandro Barreto
well, it still didn’t help. I didn’t understand what you said about putting the XML of Fragment and Activity as a whole
– Marcos Vinícius
I say that it would be good to put the XML of the layout of Activity and Fragment, just to see to be has something influencing.
– Wakim