EasyClick 原生UI連載目錄
- EasyClick 原生UI教程
- EasyClick 原生UI連載之 CardViwe 布局
- 效果圖
- 屬性詳解
- 代碼演示
EasyClick 原生UI教程
講師:Mr-老鬼,QQ:1156346325
EasyClick 原生UI教程電梯直達:
EasyClick 原生UI教程總綱
EasyClick 原生UI連載之 CardViwe 布局
CardView 是 Google 官方發布 MD 風格卡片布局控制元件,開發者可以很方便的使用它將布局做成卡片效果
效果圖


屬性詳解
私有屬性
具體設定效果看代碼和上面的效果圖,

公有屬性參考:原生UI連載三
代碼演示
<?xml version="1.0" encoding="UTF-8" ?>
<ScrollView xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:android="http://schemas.android.com/apk/res/android"
xsi:noNamespaceSchemaLocation="layout.xsd"
android:layout_height="match_parent"
android:layout_width="match_parent">
<LinearLayout android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:padding="20dp">
<CardView android:cardBackgroundColor="#aabbcc"
android:cardCornerRadius="30dp">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="CardView演示1" />
<ImageView android:src="https://t7.baidu.com/it/u=1999592614,2777861859&fm=193&f=GIF"
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="CENTER_CROP" />
</LinearLayout>
</CardView>
<CardView android:cardBackgroundColor="#FFFFF0"
android:cardCornerRadius="20dp">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="CardView演示2" />
<ImageView android:src="https://t7.baidu.com/it/u=1928770808,2488987808&fm=193&f=GIF"
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="CENTER_CROP" />
</LinearLayout>
</CardView>
<CardView android:cardCornerRadius="10dp">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="CardView演示3" />
<ImageView android:src="https://t7.baidu.com/it/u=3527596838,2511254203&fm=193&f=GIF"
android:layout_width="80dp"
android:layout_height="80dp"
android:scaleType="CENTER_CROP" />
</LinearLayout>
</CardView>
<CardView android:cardCornerRadius="10dp">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="CardView演示4" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<CheckBox android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:text="復選框1" />
<CheckBox android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:text="復選框2" />
<CheckBox android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:text="復選框3" />
</LinearLayout>
</LinearLayout>
</CardView>
<CardView android:cardCornerRadius="10dp">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="CardView演示5" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:text="資訊:" />
<EditText android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:hint="請輸入內容" />
<CheckBox android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:text="確認" />
</LinearLayout>
</LinearLayout>
</CardView>
<CardView android:cardCornerRadius="10dp">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="CardView演示6" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:text="資訊:" />
<EditText android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:hint="請輸入內容" />
<CheckBox android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:text="確認" />
</LinearLayout>
</LinearLayout>
</CardView>
<CardView android:cardCornerRadius="10dp">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="CardView演示7" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
<TextView android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:text="資訊:" />
<EditText android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:hint="請輸入內容" />
<CheckBox android:layout_width="wrap_parent"
android:layout_height="wrap_content"
android:text="確認" />
</LinearLayout>
</LinearLayout>
</CardView>
</LinearLayout>
</ScrollView>
我是Mr-老鬼、QQ1156346325 ,交流QQ群:620028786,647082990
------------------------------------------------著作權宣告------------------------------------------------------
本文著作權所有~Mr-老鬼 ~轉載請注明原文地址
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/278884.html
標籤:其他
