shape图形的使用
shape图形的使用
在项目中如果用到有规律的常规的图形,在能够掌握的前提下建议使用shape图形,shape图形相对与图片来说,占用资源更小,并且使用起来不会失真。
效果图
- shape图形1
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 主体颜色 填充颜色 -->
<solid android:color="#FF00FFFF" />
<!-- 圆角 -->
<corners
android:bottomLeftRadius="15dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="15dp"
android:topRightRadius="0dp" />
</shape>
- shape图形2
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 主体颜色 填充颜色 -->
<solid android:color="#33000000" />
<!-- 圆角 -->
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="15dp"
android:topLeftRadius="0dp"
android:topRightRadius="15dp" />
</shape>
- shape图形3
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 渐变颜色 -->
<gradient
android:centerColor="#33000000"
android:endColor="#99000000"
android:startColor="#99000000" />
<!-- 圆角 -->
<corners
android:bottomLeftRadius="15dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="0dp"
android:topRightRadius="15dp" />
</shape>
- shape图形4
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 渐变颜色 -->
<solid android:color="#FFFF00FF" />
<!-- 圆角 -->
<corners android:radius="10dp" />
</shape>
- shape图形5
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 渐变颜色 -->
<solid android:color="#FFFF00FF" />
<!-- 圆角 -->
<corners android:radius="10dp" />
<stroke
android:width="5dp"
android:color="#FF000000"
android:dashGap="3dp"
android:dashWidth="2dp" />
</shape>
使用
文件存放位置
用法
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape"
android:padding="20dp"
android:text="shape图形1"
android:textSize="20sp" />
Shape图形可以当作是一张图片来使用,和设置背景是一样的用法。
属性介绍
solid
实心,主体
android:color指定填充的颜色
gradient
渐变
android:startColor 设置起始颜色
android:centerColor 设置中间颜色
android:endColor 设置结束颜色
stroke
描边
android:width 描边的宽度
android:color 描边的颜色
android:dashWidth 横线的宽度
android:dashGap 表示之间隔开的距离。
corners
圆角
android:radius 四个角的弧度
android:topRightRadius 右上角弧度
android:bottomLeftRadius 左下角弧度
android:topLeftRadius 左上角弧度
android:bottomRightRadius 右下角弧度
padding
间隔
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
shape图形的使用的更多相关文章
- android shape图形优化Button效果
android shape可以让我们通过定义xml文件的方式创建图形,当然只能实现一些比较简单的图形(圆形,矩形,椭圆,线段),但是已经相当不错了,通过shape创建的图形作为控件的背景已经基本可以满 ...
- Android 中 shape 图形的使用
转载于:http://kofi1122.blog.51cto.com/2815761/521605 Android中常常使用shape来定义控件的一些显示属性,今天看了一些shape的使用,对shap ...
- shape 图形
主要属性: <?xml version="1.0"encoding="utf-8"?><shape > <corners /> ...
- 背水一战 Windows 10 (12) - 绘图: Shape, Path
[源码下载] 背水一战 Windows 10 (12) - 绘图: Shape, Path 作者:webabcd 介绍背水一战 Windows 10 之 绘图 Shape - 图形 Path - 路径 ...
- Netron开发快速上手(一):GraphControl,Shape,Connector和Connection
版权所有,引用请注明出处:<<http://www.cnblogs.com/dragon/p/5203663.html >> 本文所用示例下载FlowChart.zip 一个用 ...
- 绘图: Shape, Path
Shape - 图形 Path - 路径 示例1.演示“Shape”相关知识点Drawing/Shape.xaml <Page x:Class="Windows10.Drawing.S ...
- 重新想象 Windows 8 Store Apps (18) - 绘图: Shape, Path, Stroke, Brush
原文:重新想象 Windows 8 Store Apps (18) - 绘图: Shape, Path, Stroke, Brush [源码下载] 重新想象 Windows 8 Store Apps ...
- Android Drawable - Shape Drawable使用详解(附图)
TIPS shape图形 –简单介绍 shape图形 –如何画? shape图形 –参数详细解析 shape图形 –如何用? shape图形 –实际开发应用场景 shape图形简单介绍 用xml实现一 ...
- FlasActionScript3随学随机
1.跳转页面代码.下载代码(new URLRequest(下载地址)): var request1:URLRequest=new URLRequest("http://www.baidu.c ...
随机推荐
- Codeforces 812E Sagheer and Apple Tree
大致题意: 给你一颗树,这个树有下列特征:每个节点上有若干个苹果,且从根节点到任意叶子节点的路径长度奇偶性相同. 甲和乙玩(闲)游(得)戏(慌). 游戏过程中,甲乙轮流将任意一个节点的若干个苹果移向它 ...
- UVALive - 3942:Remember the Word
发现字典里面的单词数目多且长度短,可以用字典树保存 f[i]表示s[i~L]的分割方式,则有f[i]=∑f[i+len(word[j])] 其中word[j]为s[i~L]的前缀 注意字典树又叫前 ...
- ●POJ 1228 Grandpas Estate
题链: http://poj.org/problem?id=1228 题解: 计算几何,凸包 题意:给出一些点,求出其凸包,问是否是一个稳定的凸包. 稳定凸包:不能通过新加点使得原来凸包上的点(包括原 ...
- SPOJ 7258 Lexicographical Substring Search
Little Daniel loves to play with strings! He always finds different ways to have fun with strings! K ...
- [Noi2015]荷马史诗
来自FallDream的博客,未经允许,请勿转载,谢谢. 追逐影子的人,自己就是影子. ——荷马 Allison 最近迷上了文学.她喜欢在一个慵懒的午后,细细地品上一杯卡布奇诺,静静地阅读她爱不释手的 ...
- 【图文详解】linux下配置远程免密登录
linux下各种集群搭建往往需要配置远程免密登录,本文主要描述了CentOs6.3系统下配置免密登录的详细过程. ssh远程登录,两种身份验证: 用户名+密码 密钥验证 机器1生成密钥对并将公钥发给机 ...
- HttpServletRequest获取URL?后面的内容
获取URL?后面的内容 如https://i.cnblogs.com/EditPosts.aspx?opt=1 String para = request.getQueryString(): para ...
- IE下iframe跨域session和cookie失效问题的解决方案
http://blog.csdn.net/wauit/article/details/9875157
- JavaScript进阶-this
1.什么是this? 当一个函数被调用时,会创建一个活动记录(有时候也称为执行上下文).这个记录会包 含函数在哪里被调用(调用栈).函数的调用方法.传入的参数等信息.this 就是记录的 其中一个属性 ...
- input type="tel" 数字输入框显示圆点
最近开发中遇到一个这样的需求,要求input输入框在手机端出现数字键盘的同时显示圆点,试过各种方法都不太理想, 最终经过查阅大量资料后,终于实现了需求. ●我们一般的密码输入框是这样的: <in ...