Android使用xml自定义图片实例详解
2017-05-25 16:11
976 查看
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>
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
您可能感兴趣的文章:
相关文章推荐
- Android 自定义imageview实现图片缩放实例详解
- Android使用xml自定义图片
- 【整理】Android中使用XML自定义组件各种状态下的背景图片
- android AsyncTask介绍 详解AsyncTask的使用 使用实例---加载网络图片
- Android自定义View中attrs.xml的实例详解
- Android中使用XML自定义组件各种状态下的背景图片
- [Android]自定义组件示例:使用attrs.xml文件定制RadioButton
- Android提高篇之自定义dialog实现processDialog“正在加载”效果、使用Animation实现图片旋转
- Android中View(视图)绘制不同状态背景图片原理深入分析以及StateListDrawable使用详解
- Android深入浅出系列之实例应用—简单的手指拖动图片,图片滑来滑去显示应用Gallery和BaseAdapter以及ImageView的使用
- Android菜单详解(五)——使用XML生成菜单
- 自定义view时使用xml传递参数-设定TextView中图片大小
- Android自定义模拟器skin 自定义属性(attrs.xml,TypedArray)的使用
- [Android] PorterDuff使用实例----实现新浪微博图片下载效果
- android的XML布局文件上使用自定义的类
- Android中View绘制不同状态背景图片原理深入分析以及StateListDrawable使用详解
- android自定义Button,通过在XML布局文件里直接使用自定义参数
- 关于android图片的传输,android图片传输方式,xml传输图片,android 使用base64编码图片使用xml传输图片
- [Android] AsyncTask使用实例---加载网络图片
- 初学Android,使用自定义的XML资源(十八)