码迷,mamicode.com
首页 > 移动开发 > 详细

Android-- CardView初级使用

时间:2015-11-12 09:52:40      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:

CardView发布于android sdk v7的支持包中,具体如何将项目加入v7包,请看这里传送门

Android – 5.0 Lollipop

卡片化是全新的Material风格设计中重要的组成部分之一,卡片设计适合重要信息的展示,以及在list中作为一个包含有复杂操作的item使用。

CardView继承于Framelayout,比FrameLayout多了3个重要的属性,card_view:cardElevationcard_view:cardCornerRadiuscard_view:cardBackgroundColor

  • card_view:cardElevation,可以设置卡片的阴影,可以使CardView在z轴方向上有一种抬升的视觉效果,public void setCardElevation (float radius)
  • card_view:cardCornerRadius,显然就是设置CardView的圆角了。对应代码里的方法public void setRadius (float radius)
  • card_view:cardBackgroundColor,设置CardView背景颜色,这个属性是不会影响阴影card_view:cardElevation的效果的。public void setCardBackgroundColor (int color)

 

 
<android.support.v7.widget.CardView
android: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="这里是CardView"
                />
</android.support.v7.widget.CardView>

Android-- CardView初级使用

标签:

原文地址:http://www.cnblogs.com/zrui513/p/4957951.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!