博客
关于我
Android使用xml的shape自定义图形
阅读量:344 次
发布时间:2019-03-04

本文共 886 字,大约阅读时间需要 2 分钟。

android:shape=[“rectangle” | “oval” | “line” | “ring”]
shape的形状,默认为矩形,可以设置为矩形(rectangle)、椭圆形(oval)、线性形状(line)、环形(ring)

1.自定义纯色圆形
round.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"       android:shape="rectangle" >    <solid android:color="#283593"/>    <corners android:radius="50dp" /></shape>
//半径为50dp,颜色为#283593的圆形<ImageView    android:layout_width="50dp"    android:layout_height="50dp"    android:scaleType="center"    android:src="@drawable/manual_tuner_band_bg" />

2.自定义纯色矩形
rectangle.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android"       android:shape="rectangle" >    <solid android:color="#283593"/>    <corners android:radius="50dp" /></shape>
//宽为30dp,高为50dp,颜色为#283593的矩形<ImageView    android:layout_width="30dp"    android:layout_height="50dp"    android:scaleType="center"    android:src="@drawable/manual_tuner_band_bg" />

转载地址:http://ysre.baihongyu.com/

你可能感兴趣的文章
从零开始学安全(十六)● Linux vim命令
查看>>
从零开始学安全(三十四)●百度杯 ctf比赛 九月场 sqli
查看>>
3389连接痕迹清除
查看>>
发生系统错误 6118
查看>>
阿里巴巴Json工具-Fastjson教程
查看>>
Spring Cloud Gateway - 快速开始
查看>>
Spring Security 实战干货:理解AuthenticationManager
查看>>
Java对象转JSON时如何动态的增删改查属性
查看>>
Python 面向对象进阶
查看>>
Linux常用统计命令之wc
查看>>
Git安装及使用以及连接GitHub方法详解
查看>>
docker容器与虚拟机的区别
查看>>
shell脚本里使用echo输出颜色
查看>>
Python2跟Python3的区别
查看>>
并发编程——IO模型详解
查看>>
Java之封装,继承,多态
查看>>
wait()与notify()
查看>>
使用js打印时去除页眉页脚
查看>>
Spring security OAuth2.0认证授权学习第二天(基础概念-RBAC)
查看>>
ORA-00904: "FILED_TYPE": 标识符无效
查看>>