Use of the CardView "ANDROID-MD"

Source: Internet
Author: User

CardView is a layout control in the new Android 5.0 feature--material design that displays a rounded, card-like view through property settings.

1. CardView Properties:

App:cardCornerRadius:CardView Fillet size        app:cardElevation:CardView shadow size        app:cardMaxElevation:CardView maximum shadow Size        whether the content in the App:cardPreventCornerOverlap:CardView overlaps with the fillet, true does not overlap        Note: If you have a picture of a fill layout in CardView, If you do not set Cardpreventcorneroverlap to true, the four corners of the picture            will extend beyond the rounded corners of the CardView

2. Demo Code:

<Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:app= "Http://schemas.android.com/apk/res-auto"Android:id= "@+id/activity_main"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent">    <Android.support.v7.widget.CardViewAndroid:layout_width= "Match_parent"Android:layout_height= "200.0dip"Android:layout_margin= "20.0dip"App:cardcornerradius= "10.0dip"app:cardelevation= "5.0dip"app:cardmaxelevation= "15.0dip"App:cardpreventcorneroverlap= "true">        <ImageViewAndroid:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:contentdescription= "@string/app_name"Android:scaletype= "Centercrop"android:src= "@mipmap/bg" />        <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:layout_gravity= "Center"Android:text= "This is A CardView"Android:textcolor= "#FFFFFFFF"android:textsize= "24.0SP"Android:textstyle= "Bold" />    </Android.support.v7.widget.CardView></Relativelayout>

Operation Result:

The above is the introduction of simple use of CardView, the following sticker code on the cloud source, for your reference.

Demo Address

Use of the CardView "ANDROID-MD"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.