canvas.drawRoundRect方法,绘制圆角矩形
来源:互联网 发布:asp.net 字符串转json 编辑:程序博客网 时间:2024/06/05 05:03
public void drawRoundRect (RectF rect, float rx, float ry, Paint paint)
Draw the specified round-rect using the specified paint. The roundrect will be filled or framed based on the Style in the paint.
Parameters
rect The rectangular bounds of the roundRect to be drawn
rx The x-radius of the oval used to round the corners
ry The y-radius of the oval used to round the corners
paint The paint used to draw the roundRect
【功能说明】该方法用于在画布上绘制圆角矩形,通过指定RectF对象以及圆角半径来实现。该方法是绘制圆角矩形的主要方法,同时也可以通过设置画笔的空心效果来绘制空心的圆角矩形。
【基本语法】public void drawRoundRect (RectF rect, float rx, float ry, Paint paint)
参数说明
rect:RectF对象。
rx:x方向上的圆角半径。
ry:y方向上的圆角半径。
paint:绘制时所使用的画笔。
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
//新建一只画笔,并设置为绿色属性
Paint _paint = new Paint();
_paint.setColor(Color.GREEN);
//新建矩形r1
RectF r1 = new RectF();
r1.left = 50;
r1.right = 250;
r1.top = 50 ;
r1.bottom = 150;
//新建矩形r2
RectF r2 = new RectF();
r2.left = 50;
r2.right = 250;
r2.top = 200 ;
r2.bottom = 300;
//画出矩形r1
canvas.drawRect(r1, _paint);
//画出圆角矩形r2
_paint.setColor(Color.rgb(204, 204, 204));
canvas.drawRoundRect(r2, 10, 10, _paint);
}
Draw the specified round-rect using the specified paint. The roundrect will be filled or framed based on the Style in the paint.
Parameters
rect The rectangular bounds of the roundRect to be drawn
rx The x-radius of the oval used to round the corners
ry The y-radius of the oval used to round the corners
paint The paint used to draw the roundRect
【功能说明】该方法用于在画布上绘制圆角矩形,通过指定RectF对象以及圆角半径来实现。该方法是绘制圆角矩形的主要方法,同时也可以通过设置画笔的空心效果来绘制空心的圆角矩形。
【基本语法】public void drawRoundRect (RectF rect, float rx, float ry, Paint paint)
参数说明
rect:RectF对象。
rx:x方向上的圆角半径。
ry:y方向上的圆角半径。
paint:绘制时所使用的画笔。
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
//新建一只画笔,并设置为绿色属性
Paint _paint = new Paint();
_paint.setColor(Color.GREEN);
//新建矩形r1
RectF r1 = new RectF();
r1.left = 50;
r1.right = 250;
r1.top = 50 ;
r1.bottom = 150;
//新建矩形r2
RectF r2 = new RectF();
r2.left = 50;
r2.right = 250;
r2.top = 200 ;
r2.bottom = 300;
//画出矩形r1
canvas.drawRect(r1, _paint);
//画出圆角矩形r2
_paint.setColor(Color.rgb(204, 204, 204));
canvas.drawRoundRect(r2, 10, 10, _paint);
}
1 2
- canvas.drawRoundRect方法,绘制圆角矩形
- drawRoundRect方法:绘制圆角矩形
- drawRoundRect方法:绘制圆角矩形
- Canvas绘制圆角矩形
- 自定义控件,圆角矩形(drawRoundRect)
- 在Canvas中绘制圆角矩形
- 详述Canvas(五)/绘制圆角矩形
- html5 canvas 绘制圆角矩形
- 详述Canvas(五)/绘制圆角矩形
- HTML5 JS Canvas利用贝塞尔曲线绘制圆角矩形
- Canvas绘制圆角矩形时的圆角粗边问题
- html5<canvas>标签绘制矩形,线条,圆
- HTML5 Canvas: 绘制矩形
- canvas绘制矩形
- canvas绘制矩形
- Canvas学习:绘制矩形
- 绘制圆角矩形(方法 )
- VML绘制圆角矩形的方法
- Yii框架zii.widgets.grid自定义按钮,ajax触发事件并提示
- A and B and Interesting Substrings cf294
- mmap那些事之android property实现之二
- 2015/3/19 文献阅读笔记
- layoutSubviews总结
- canvas.drawRoundRect方法,绘制圆角矩形
- 数据结构---单链表(建立,节点删除,节点插入)
- 【Error】SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
- android 中 获取 文字宽度
- postgres 数据库常用sql语句
- 临沂市蔬菜研究所科技部生产研发
- Cloneable接口使用
- kmap的实现分析与实验
- Git常用命令