最新国产好看的视频,伊人天堂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)微信聊天輸入框,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時(shí)回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評論

尼勒克县| 垣曲县| 桐乡市| 北安市| 铜陵市| 章丘市| 杂多县| 曲麻莱县| 贺兰县| 郴州市| 霞浦县| 耒阳市| 双辽市| 桦南县| 云浮市| 资中县| 宣化县| 汝州市| 镇安县| 调兵山市| 镇坪县| 沽源县| 通河县| 曲阳县| 华安县| 宁化县| 滕州市| 武威市| 沧州市| 威海市| 呼玛县| 福鼎市| 廉江市| 濉溪县| 福州市| 盐城市| 乐陵市| 嫩江县| 阿拉善盟| 达拉特旗| 千阳县|