layout_margin in CardView is not working properly

If you use RecyclerView to add CardView, android:layout_margin should be sufficient. But using ListView to add CardView, you might do this: <FrameLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”wrap_content” > <android.support.v7.widget.CardView xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:layout_marginLeft=”11dp” android:layout_marginRight=”11dp” android:layout_marginTop=”11dp”> (other layout …) </android.support.v7.widget.CardView> </FrameLayout> But it is usually not the optimal one.

How to change card_view:cardCornerRadius programmatically

Use CardView.setRadius(float), see androidx.cardview. (It is worth noting that this will have no effect if you also invoke setBackgroundColor, make sure to use setCardBackgroundColor instead). You must specify a pixel size, rather than dp value, e.g. for corner radius of 4dp you can invoke, in Kotlin: radius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4f, context.resources.displayMetrics)

MaterialCardView crashes with material:1.1.0

you can just keep it in your materialcardview itself also: <com.google.android.material.card.MaterialCardView android:layout_width=”match_parent” android:layout_height=”wrap_content” app:cardCornerRadius=”8dp” **** android:theme=”@style/Theme.MaterialComponents.Light” ***** app:cardElevation=”8dp”>

What’s the difference between the CardView from com.google.android.material and android.support.v7.widget

There are 3 versions: android.support.v7.widget.CardView: it is provided by the old support libraries and it is deprecated. androidx.cardview.widget.CardView it is the androidx version and it replaced the support libraries. To use it you have to add the dependency implementation ‘androidx.cardview:cardview:x.x.x’. com.google.android.material.card.MaterialCardView is provided by the Material Components Library. To use it you have to add … Read more

Expand and collapse CardView

Use an expandable list view with cardview or even You can use wrap content as height of cardview and use textview inside it below title, so on click make the textview visible and vice-versa. but isn’t it bad design ? nope it isn’t if you give some transition or animation when it’s expanded or collapsed … Read more

how to set colored border on cardview

Started from v28 design support library we can use Material Card View, which provides us with a material styled cardview implementation out of the box. <android.support.design.card.MaterialCardView android:layout_width=”100dp” android:layout_height=”100dp” android:layout_margin=”10dp”> … child views … </android.support.design.card.MaterialCardView> You can further style the cardview by using two of the attributes that come with it: app:strokeColor – The colour to … Read more

CardView with different corner radius

It requires the official MaterialCardView (which extends the androidx.cardview.widget.CardView) and at least the version 1.1.0 of the Material components library. Add to your layout the MaterialCardView: <com.google.android.material.card.MaterialCardView style=”@style/CustomCardViewStyle” …> </com.google.android.material.card.MaterialCardView> Define a custom style inheriting a material card style (for example Widget.MaterialComponents.CardView) and use the shapeAppearanceOverlay attribute: <style name=”CustomCardViewStyle” parent=”@style/Widget.MaterialComponents.CardView”> <item name=”shapeAppearanceOverlay”>@style/ShapeAppearanceOverlay_card_custom_corners</item> </style> <style name=”ShapeAppearanceOverlay_card_custom_corners” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)