CardView在設(shè)置陰影的效果上來講,確實(shí)是蠻不錯(cuò)的。
但是涉及到變更陰影顏色這個(gè)需求,就不是太好操作。
然后就自己描邊畫了一個(gè)陰影效果,分享,支持任何顏色。
效果:
xml-selector
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="true"> <layer-list> <item android:right="1dp" android:top="2dp"> <layer-list> <item> <shape android:shape="rectangle"> <solid android:color="#15cbf2e0" /> <padding android:bottom="6px" android:left="6px" android:right="6px" android:top="6px" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#16cbf2e0" /> <padding android:bottom="4px" android:left="4px" android:right="4px" android:top="4px" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#17cbf2e0" /> <padding android:bottom="2px" android:left="2px" android:right="2px" android:top="2px" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#18cbf2e0" /> <padding android:bottom="3px" android:left="2px" android:right="2px" android:top="1px" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#19cbf2e0" /> <padding android:bottom="3px" android:left="2px" android:right="2px" android:top="1px" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#20cbf2e0" /> <padding android:bottom="3px" android:left="2px" android:right="2px" android:top="1px" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#21cbf2e0" /> <padding android:bottom="3px" android:left="2px" android:right="2px" android:top="1px" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#22cbf2e0" /> <padding android:bottom="3px" android:left="2px" android:right="2px" android:top="1px" /> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="#23cbf2e0" /> <padding android:bottom="3px" android:left="2px" android:right="2px" android:top="1px" /> </shape> </item> </layer-list> </item> <item> <shape android:shape="rectangle"> <solid android:color="@color/white" /> </shape> </item> </layer-list> </item> </selector>
當(dāng)前名稱:Android控件陰影顏色調(diào)整示例-創(chuàng)新互聯(lián)
網(wǎng)站路徑:http://jinyejixie.com/article34/psppe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、網(wǎng)站排名、網(wǎng)站維護(hù)、電子商務(wù)、搜索引擎優(yōu)化、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容