中国建筑土木建设有限公司网站,成都制作开发小程序,懒人做图网站,网站建设需要学多久本文主要介绍CardView的使用#xff0c;CardView是继承自FrameLayout#xff0c;使用比较简单#xff0c;只需要用CardView包含其他View就可以实现卡片效果了。实现效果如下#xff1a;加入依赖库dependencies {….compile com.android.support:cardview-v7:22.2.0}Layout布…本文主要介绍CardView的使用CardView是继承自FrameLayout使用比较简单只需要用CardView包含其他View就可以实现卡片效果了。实现效果如下加入依赖库dependencies {….compile com.android.support:cardview-v7:22.2.0}Layout布局android:layout_widthmatch_parentandroid:layout_heightwrap_contentapp:cardCornerRadius10dpapp:cardElevation10dpandroid:layout_marginBottomdimen/card_marginandroid:layout_marginLeftdimen/card_marginandroid:layout_marginRightdimen/card_marginstylestyle/CardView.Contentandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:orientationhorizontalandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:srcdrawable/book1 /android:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:layout_marginLeft10dpandroid:orientationverticalandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:textstring/book_title_1android:textAppearancestyle/TextAppearance.AppCompat.Titleandroid:textColorcolor/primary_text /android:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:layout_marginTop2dpandroid:textstring/book_description_1android:textColorcolor/secondary_text /app:cardBackgroundColor 设置CardView背景颜色app:cardCornerRadius 设置CardView圆角大小app:cardElevation 设置CardView阴影高度项目源码已发布到Github以后慢慢加入其他控件的使用。源码地址MaterialDesignExample以上就是本文的全部内容希望对大家的学习有所帮助也希望大家多多支持脚本之家。