Use of the Android Card view component CardView

Source: Internet
Author: User

CardView is a component that is placed in the Support Library V7 package (Recyclerview is also here, which is explained in detail in the blog behind)

At the beginning of writing Recyclerview's demo, found that others are written out of the card-type layout, very good-looking oh ~ and I wrote or the original ListView a style, checked for half a day, finally found in the layout of the article appeared different, This also involves the use of CardView.

<span style= "FONT-SIZE:14PX;" ><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=" 5DP "card_view:cardbackgroundcolor=" @color/cardview_dark_background "Card_v iew:cardcornerradius= "5DP" > <relativelayout android:layout_width= "match_parent" Android:la              yout_height= "100DP" android:padding= "5DP" > <imageview android:id= "@+id/pic" Android:layout_width= "Match_parent" android:layout_height= "Match_parent" Android:layout_c Enterinparent= "true" android:scaletype= "Centercrop"/> <textview Android:clicka Ble= "true" android:id= "@+id/name" android:layout_width= "Match_parent" Android:layout_height= "Match_parent" android:layout_marginbottom= "10DP" android:layout_marginright= "10DP" Android:gravity= "Right|bottom" android:textcolor= "@android: Color/white" Android:tex Tsize= "24sp"/> </RelativeLayout> </android.support.v7.widget.CardView> </span>
probably see, it also uses the CardView control to wrap the original item layout, the width is still used to fill the parent form

Layout_margin represents the interval between cards, which should be half the real interval (reason you should understand)

Cardcornerradius indicates the arc of the peripheral fillet of the card

Cardbackgroundcolor indicates the card background color

The latter two properties belong to the Card_view namespace, so don't forget to add the named control when you use it




Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Use of the Android Card view component CardView

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.