Android-cardview Simple to use

Source: Internet
Author: User

CardView is a 5.0 or more version of the control, is a card-style layout, inherits the Framlayout, but can use Compatibility Pack older compatible with more than 4.0 devices.

Test environment is Android studio

1. Join the dependency:

<span style= "FONT-SIZE:14PX;" >compile ' com.android.support:cardview-v7:21.0.3 ' </span>

2. Write the layout:

<span style= "FONT-SIZE:14PX;" ><android.support.v7.widget.cardview xmlns:android= "http://schemas.android.com/apk/res/android"    xmlns : app= "Http://schemas.android.com/apk/res-auto"    android:id= "@+id/card_view"    android:layout_width= "match _parent "    android:layout_height=" wrap_content "    app:cardcornerradius=" 4DP "    app:cardbackgroundcolor=" @color/style_color_primary ">    <linearlayout        android:layout_width=" Match_parent "        android: layout_height= "Wrap_content" >        <textview            android:layout_width= "wrap_content"            android:layout _height= "Wrap_content"            android:text= "Hello cardview!" />    </LinearLayout></android.support.v7.widget.CardView></span>

Note: There are two properties Cardcornerradius and Cardbackgroundcolor, which are basically known for their meaning, the first is the fillet radius and the second is the background color.

There is also a elevator attribute, but only if the version is more than 5.0 can show the effect.

Android-cardview Simple to use

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.