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 be used for the given stroke, this must be set in order to display a stroke
  • app:strokeWidth – The width to be applied to the stroke of the view

Leave a Comment

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