
LayerDrawable
<@R_623_3419@> 标签可是设置LayerDrawable,一种有层次的Drawable叠加效果,<@R_623_3419@> 可以包含多个 <item>标签,
每个 <item>代表一个Drawable。<item>可以通过left、right、top、bottom设置左右上下的偏移量,<item>可以应用一个图片,也可以是一个shape
我们来模仿实现微信的聊天输入框:
先设置绿色的背景:
<?xml version="1.0" enCoding="utf-8"?> <@R_623_3419@ xmlns:androID="http://schemas.androID.com/apk/res/androID"> <item> <shape androID:shape="rectangle"> <solID androID:color="@androID:color/holo_green_light" /> </shape> </item> </@R_623_3419@>
再叠加一层白色,留出侧面绿色线条的高度:
<?xml version="1.0" enCoding="utf-8"?> <@R_623_3419@ 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> </@R_623_3419@>
再铺上一层白色,覆盖已经设置好的背景,留出底部和侧面的线条,中间的一层其实就是为了留出两边的绿色线框的高度:
<?xml version="1.0" enCoding="utf-8"?> <@R_623_3419@ 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> </@R_623_3419@>
以上所述是小编给大家介绍的AndroID 使用<@R_623_3419@>实现微信聊天输入框,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程小技巧网站的支持!
总结以上是内存溢出为你收集整理的Android 使用<layer-list>实现微信聊天输入框功能全部内容,希望文章能够帮你解决Android 使用<layer-list>实现微信聊天输入框功能所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)