发布于 2017-08-27 04:43:22 | 75 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

Android移动端操作系统

Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。尚未有统一中文名称,中国大陆地区较多人使用“安卓”或“安致”。


这篇文章主要介绍了 Android使用xml自定义图片实例详解的相关资料,需要的朋友可以参考下

Android使用xml自定义图片实例详解

实现效果图:

白色圆角图片

bg_round_rectangle_white.xml


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">

 <!-- 填充 -->
 <solid android:color="#FFFFFF" />

 <!-- 圆角 -->
 <corners
  android:radius="2dp"/>

 <!-- 描边 -->
 <stroke
  android:width="1dp"
  android:color="#D5D5D5"/>

</shape>

白色圆角虚线框

bg_round_rectangle_white_dash.xml


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">

 <!-- 填充 -->
 <solid android:color="#FFFFFF" />

 <!-- 圆角 -->
 <corners
  android:radius="2dp"/>

 <!-- 虚线描边 -->
 <stroke
  android:width="1dp"
  android:color="#DD4041"
  android:dashWidth="1dp"
  android:dashGap="2dp"/>

</shape>

红色圆角图片

bg_round_rectangle_red.xml


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">

 <!-- 填充 -->
 <solid android:color="#F15C5D" />

 <!-- 圆角 -->
 <corners
  android:radius="2dp"/>

 <!-- 描边 -->
 <stroke
  android:width="1dp"
  android:color="#D42D2E"/>

</shape>

绿色圆角图片

bg_round_rectangle_green.xml



<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
 android:shape="rectangle">

 <!-- 填充 -->
 <solid android:color="#88C14E" />

 <!-- 圆角 -->
 <corners
  android:radius="2dp"/>

 <!-- 描边 -->
 <stroke
  android:width="1dp"
  android:color="#6FA13C"/>

</shape>

正三角形图片

triangle_white_arrow_up.xml



<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
 android:fromDegrees="45"
 android:toDegrees="45"
 android:pivotX="-40%"
 android:pivotY="80%">

 <shape android:shape="rectangle">
  <solid android:color="#000000"/>
 </shape>

</rotate>

倒立正三角形图片

triangle_white_arrow_down.xml



<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
 android:fromDegrees="45"
 android:toDegrees="45"
 android:pivotX="135%"
 android:pivotY="15%">

 <shape android:shape="rectangle">
  <solid android:color="#000000"/>
 </shape>

</rotate>

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务