CardView
本文由 Luzhuo 编写,请尊重个人劳动成果,转发请保留该信息.
原文: http://blog.youkuaiyun.com/Rozol/article/details/50197821
微博: http://weibo.com/u/2524456400
- CardView是带有立体效果的卡片View.
- 只有api21版本才有z轴,而低版本不能添加z轴,可以使用CardView弥补低版本的不足.
- 库导入:
compile 'com.android.support:cardview-v7:24.2.1'
基本使用
基本代码:
<android.support.v7.widget.CardView android:id="@+id/ToolBar" android:layout_width="300dp" android:layout_height="120dp" />
效果:
源码研究
XML属性研究:
<declare-styleable name="CardView"> <attr name="cardBackgroundColor" format="color" />