国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

學習使用Material Design控件(三)使用CardView實現卡片效果

2019-10-22 18:31:28
字體:
來源:轉載
供稿:網友

本文主要介紹CardView的使用,CardView是繼承自FrameLayout,使用比較簡單,只需要用CardView包含其他View就可以實現卡片效果了。

實現效果如下:

Material,Design,CardView,卡片

加入依賴庫

dependencies {  ….  compile 'com.android.support:cardview-v7:22.2.0'}

Layout布局

 <android.support.v7.widget.CardView        android:layout_width="match_parent"        android:layout_height="wrap_content"        app:cardCornerRadius="10dp"        app:cardElevation="10dp"        android:layout_marginBottom="@dimen/card_margin"        android:layout_marginLeft="@dimen/card_margin"        android:layout_marginRight="@dimen/card_margin">        <LinearLayout          style="@style/CardView.Content"          android:layout_width="match_parent"          android:layout_height="wrap_content"          android:orientation="horizontal">          <ImageView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:src="@drawable/book1" />          <LinearLayout            android:layout_width="match_parent"            android:layout_height="wrap_content"            android:layout_marginLeft="10dp"            android:orientation="vertical">            <TextView              android:layout_width="match_parent"              android:layout_height="wrap_content"              android:text="@string/book_title_1"              android:textAppearance="@style/TextAppearance.AppCompat.Title"              android:textColor="@color/primary_text" />            <TextView              android:layout_width="match_parent"              android:layout_height="wrap_content"              android:layout_marginTop="2dp"              android:text="@string/book_description_1"              android:textColor="@color/secondary_text" />          </LinearLayout>        </LinearLayout></android.support.v7.widget.CardView>

app:cardBackgroundColor 設置CardView背景顏色
app:cardCornerRadius 設置CardView圓角大小
app:cardElevation 設置CardView陰影高度

項目源碼已發布到Github,以后慢慢加入其他控件的使用。
 源碼地址:MaterialDesignExample

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


注:相關教程知識閱讀請移步到Android開發頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 屯昌县| 阿荣旗| 望奎县| 汕头市| 石景山区| 江城| 哈密市| 浦东新区| 延寿县| 紫阳县| 精河县| 洪湖市| 达拉特旗| 泰兴市| 综艺| 晋宁县| 双峰县| 大新县| 通化县| 斗六市| 安阳县| 石泉县| 滦南县| 开化县| 云阳县| 静宁县| 大田县| 光山县| 确山县| 枞阳县| 海安县| 永平县| 蒲城县| 荥阳市| 扶沟县| 白银市| 通河县| 镇赉县| 瓦房店市| 蒙阴县| 津市市|