本文主要介紹CardView的使用,CardView是繼承自FrameLayout,使用比較簡單,只需要用CardView包含其他View就可以實現(xiàn)卡片效果了。
創(chuàng)新互聯(lián)建站一直在為企業(yè)提供服務,多年的磨煉,使我們在創(chuàng)意設計,全網(wǎng)整合營銷推廣到技術研發(fā)擁有了開發(fā)經(jīng)驗。我們擅長傾聽企業(yè)需求,挖掘用戶對產(chǎn)品需求服務價值,為企業(yè)制作有用的創(chuàng)意設計體驗。核心團隊擁有超過10多年以上行業(yè)經(jīng)驗,涵蓋創(chuàng)意,策化,開發(fā)等專業(yè)領域,公司涉及領域有基礎互聯(lián)網(wǎng)服務服務器托管、成都APP應用開發(fā)、手機移動建站、網(wǎng)頁設計、網(wǎng)絡整合營銷。
實現(xiàn)效果如下:
加入依賴庫
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 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陰影高度
項目源碼已發(fā)布到Github,以后慢慢加入其他控件的使用。
源碼地址:MaterialDesignExample
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。
網(wǎng)站標題:學習使用MaterialDesign控件(三)使用CardView實現(xiàn)卡片效果
文章位置:http://www.rwnh.cn/article38/ihjdsp.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、網(wǎng)站內(nèi)鏈、網(wǎng)站設計公司、響應式網(wǎng)站、做網(wǎng)站、定制網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)