您的位置:首页 > Web前端 > CSS

CardView 造就不一样的样式

2016-12-27 14:13 302 查看
//第一步   

添加  
buildGradle

compile 'com.android.support:cardview-v7:24.0.0-alpha2'


//第二步

在布局文件中设置属性

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:id="@+id/activity_card_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="#6f0abdd5"
app:contentPadding="20dp"
app:cardCornerRadius="35dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="你好啊"/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardBackgroundColor="#6f0ad50d"
app:contentPadding="20dp"
app:cardCornerRadius="35dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="你好啊"/>
</android.support.v7.widget.CardView>

</LinearLayout>


//实现效果

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: