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

首頁 > 系統 > Android > 正文

Android控件陰影顏色調整示例

2019-12-12 00:35:03
字體:
來源:轉載
供稿:網友

CardView在設置陰影的效果上來講,確實是蠻不錯的。

但是涉及到變更陰影顏色這個需求,就不是太好操作。

然后就自己描邊畫了一個陰影效果,分享,支持任何顏色。

效果:

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>

關于描邊的大小什么的,都可以自己設置,顏色也一樣。都自己隨意。

使用起來也是非常簡單,

android:background="@drawable/lay_back"

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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 泸西县| 乡城县| 丹寨县| 若尔盖县| 修文县| 成都市| 宜章县| 嘉义市| 玉环县| 黄梅县| 潢川县| 华容县| 普定县| 莆田市| 沂源县| 德惠市| 海伦市| 沙河市| 普格县| 望江县| 黄浦区| 巴楚县| 余干县| 北川| 五指山市| 阿尔山市| 肥城市| 英山县| 孟津县| 芦山县| 白银市| 乃东县| 双柏县| 瑞昌市| 新丰县| 嘉祥县| 科尔| 芜湖县| 华蓥市| 岳普湖县| 临潭县|