Implementing CardView in Android

Source: Internet
Author: User

Android added a shadow effect in 5.0 primarily through CardView, which is implemented through Android.support.v7.widget.CardView in the lower version.

<relativelayout xmlns:android="Http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res/Package name"Android:id="@+id/rllistitemgame"Android:layout_width="Match_parent"android:layout_height="Wrap_content"android:paddingleft="8DP"android:paddingright="8DP"android:paddingtop="2DP"> <android. Support. V7. Widgets. CardViewAndroid:layout_width="Match_parent"android:layout_height="Wrap_content"App:cardbackgroundcolor="@android: Color/white"app:cardcornerradius="3DP"app:cardelevation="2DP"app:cardusecompatpadding="true">

You can see three more apps in the code above: properties, Cardcornerradius setting the fillet size, app:cardelevation setting the shadow size, the most important attribute is cardusecompatpadding, It defaults to true in systems below 5.0, but defaults to false in the 5.0 system, and if not set app:cardusecompatpadding= "true" will cause the shadow effect to not be visible on Android phones on the 5.0 system.
Finally, you must remember to add xmlns:app="http://schemas.android.com/apk/res/包名" this sentence.
By the way, attach the CardView compatible lib (Eclipse available) http://download.csdn.net/detail/zhong1113/8707351

Implementing CardView in Android

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.