android shape實(shí)現(xiàn)陰影或模糊邊效果
1.實(shí)現(xiàn)陰影或模糊邊效果方式:

2.通過(guò)shape來(lái)實(shí)現(xiàn),具體是通過(guò)layer-list 多層疊放的方式實(shí)現(xiàn)的
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 邊 -->
<item>
<shape android:shape="rectangle">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<solid android:color="#00CCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<solid android:color="#10CCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<solid android:color="#20CCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<solid android:color="#30CCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<solid android:color="#50CCCCCC" />
<corners android:radius="8dp" />
</shape>
</item>
<!-- 中心背景 -->
<item>
<shape android:shape="rectangle"
android:useLevel="false">
<!-- 實(shí)心 -->
<solid android:color="#ffffff" />
<corners android:radius="10dp" />
<padding android:left="10dp"
android:right="10dp"
android:top="10dp"
android:bottom="10dp"/>
</shape>
</item>
</layer-list>
使用:
android:background="@drawable/layer_white_bg"
頂部縮放了:android:top=2*5=10dp
總結(jié)
以上所述是小編給大家介紹的android shape實(shí)現(xiàn)陰影或模糊邊效果,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
如果你覺(jué)得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
相關(guān)文章
Kotlin協(xié)程flowOn與線程切換超詳細(xì)示例介紹
這篇文章主要介紹了Kotlin協(xié)程flowOn與線程切換,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-09-09
Android衛(wèi)星菜單效果的實(shí)現(xiàn)方法
這篇文章主要介紹了Android衛(wèi)星菜單效果的實(shí)現(xiàn)方法,需要的朋友可以參考下2017-05-05
Android實(shí)現(xiàn)簡(jiǎn)單的加載進(jìn)度條
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)簡(jiǎn)單的加載進(jìn)度條,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-05-05
Android ListView實(shí)現(xiàn)下拉加載功能
這篇文章主要為大家詳細(xì)介紹了Android ListView實(shí)現(xiàn)下拉加載功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-08-08
Android入門(mén)之ListView應(yīng)用解析(二)
這篇文章主要介紹了Android入門(mén)之ListView應(yīng)用,繼上一篇之后將對(duì)Android的ListView用法做更深入的剖析,需要的朋友可以參考下2014-08-08
RecyclerView實(shí)現(xiàn)常見(jiàn)的列表菜單
這篇文章主要為大家詳細(xì)介紹了用RecyclerView實(shí)現(xiàn)移動(dòng)應(yīng)用中常見(jiàn)的列表菜單,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-12-12
Android實(shí)現(xiàn)ImageView圖片雙擊放大及縮小
這篇文章主要介紹了Android實(shí)現(xiàn)ImageView圖片雙擊放大及縮小的相關(guān)資料,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-02-02

