源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

android中用xml文件实现带边框背景效果的方法

  • 时间:2022-03-25 20:29 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:android中用xml文件实现带边框背景效果的方法
[b]前言[/b] 在项目开发的过程中,有时我们会用到带边框的纯色背景图,类似效果如下: [img]http://files.jb51.net/file_images/article/201706/2017622143133097.png?2017522143145[/img] 一般的,我们会让设计给做个背景图,然后自己用.9处理一下,这样有些麻烦,我们可以简洁点实现,就是用xml文件。 [b]下面给出一个范例:[/b]
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
 <item android:right="0dp">
 <shape android:shape="rectangle" >
  <solid android:color="#f9e284"></solid>
 </shape>
 </item>
 <item
 android:right="8dp"
 android:top="8dp"
 android:left="8dp"
 android:bottom="8dp">
 <shape android:shape="rectangle" >
  <stroke
  android:color="@color/white"
  android:width="1dp"/>
 </shape>
 </item>
</layer-list>
颜色,圆角什么的,大家可以自己设置下。 [b]总结[/b] 以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对编程素材网的支持。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部