CardViewIn the support package for Android SDK V7, specifically how to add a project to the V7 package, see the portal here.
Cards are one of the most important components of the new material style design, and the card design is suitable for the presentation of important information, as well as the use of the list as an item containing complex operations.
CardViewInherit fromFramelayoutThanFrameLayout3 more important attributes,card_view:cardElevation,card_view:cardCornerRadius,card_view:cardBackgroundColor。
card_view:cardelevation , you can set the shadow of the card, you can make cardview has an uplifting visual effect on the z axis, giving the user a visual sense of important information here. Corresponding code in the method public void setcardelevation (float radius) .
card_view:cardcornerradius , is clearly set cardview the rounded corners of the . Corresponding code in the method public void Setradius (float radius) .
card_view:cardBackgroundColorSet upCardViewThe background color, this property is not affected by the shadowcard_view:cardElevationEffect of the. The method in the corresponding codepublic void setCardBackgroundColor (int color)。
<android.support.v7.widget.cardviewandroid:id="@+id/cardview"android:layout_width="Fill_parent"android:layout_height="Wrap_content"card_view:cardelevation="100DP"card_view:cardbackgroundcolor="@color/grey"card_view:cardcornerradius="8DP"android:layout_marginleft="@dimen/margin"android:layout_marginright="@dimen/margin"> <textview android:layout_width="Wrap_content" android:layout_height="Wrap_content" android:layout_margin="@dimen/margin" android:text="This is CardView." /></android.support.v7.widget.CardView>
Here is an Android official to the sample bar!
—————————————
Since November 19 has been working overtime, to spend a lot of time on the development of our end-of-the-year version, this period planning a few want to write the blog, slowly will be issued, mainly to introduce the use of new controls, and how to compatible with lollipop the following version of material style design, Material style design will also be my project team in the first quarter of 15 Android new design.
(Reproduced Please specify Source: http://kennethyo.farbox.com/post/android/2014-12-28)
CardView Primary Use