最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android 使用<layer-list>實(shí)現(xiàn)微信聊天輸入框功能

 更新時(shí)間:2017年05月05日 15:54:43   作者:vincent1245637641  
<layer-list> 標(biāo)簽可以設(shè)置LayerDrawable,一種有層次的Drawable疊加效果,<layer-list> 可以包含多個(gè) <item>標(biāo)簽。這篇文章主要介紹了Android 使用<layer-list>實(shí)現(xiàn)微信聊天輸入框,需要的朋友可以參考下

 LayerDrawable

 <layer-list> 標(biāo)簽可是設(shè)置LayerDrawable,一種有層次的Drawable疊加效果,<layer-list> 可以包含多個(gè) <item>標(biāo)簽,

 每個(gè) <item>代表一個(gè)Drawable。<item>可以通過left、right、top、bottom設(shè)置左右上下的偏移量,<item>可以應(yīng)用一個(gè)圖片,也可以是一個(gè)shape

  我們來模仿實(shí)現(xiàn)微信的聊天輸入框:

 先設(shè)置綠色的背景:

 <?xml version="1.0" encoding="utf-8"?>
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
   <shape android:shape="rectangle">
    <solid android:color="@android:color/holo_green_light" />
   </shape>
  </item>
 </layer-list>

 再疊加一層白色,留出側(cè)面綠色線條的高度:

 <?xml version="1.0" encoding="utf-8"?>
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
   <shape android:shape="rectangle">
    <solid android:color="@android:color/holo_green_light" />
   </shape>
  </item>
  <item android:bottom="8dp">
   <shape android:shape="rectangle">
    <solid android:color="@android:color/white" />
   </shape>
  </item>
 </layer-list>

再鋪上一層白色,覆蓋已經(jīng)設(shè)置好的背景,留出底部和側(cè)面的線條,中間的一層其實(shí)就是為了留出兩邊的綠色線框的高度: 

<?xml version="1.0" encoding="utf-8"?>
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
   <shape android:shape="rectangle">
    <solid android:color="@android:color/holo_green_light" />
   </shape>
  </item>
  <item android:bottom="8dp">
   <shape android:shape="rectangle">
    <solid android:color="@android:color/white" />
   </shape>
  </item>
  <item
   android:bottom="1dp"
   android:left="1dp"
   android:right="1dp"
   android:shape="rectangle">
   <shape>
    <solid android:color="@android:color/white" />
   </shape>
  </item>
 </layer-list>

 

以上所述是小編給大家介紹的Android 使用<layer-list>實(shí)現(xiàn)微信聊天輸入框,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論

宕昌县| 屏东市| 清涧县| 双江| 图木舒克市| 奉贤区| 五河县| 化州市| 繁昌县| 平陆县| 海淀区| 化隆| 晴隆县| 鲁山县| 富锦市| 延安市| 达日县| 临夏市| 三明市| 太原市| 景宁| 慈溪市| 梁河县| 钟祥市| 岳阳县| 建德市| 榆树市| 慈溪市| 博白县| 东宁县| 泾川县| 双牌县| 三河市| 亚东县| 莱西市| 永年县| 屯昌县| 黄龙县| 肥乡县| 晋中市| 清水县|