登录
首页 » Android » Android Paint画一个方框矩形

Android Paint画一个方框矩形

于 2022-07-09 发布 文件大小:31.14 kB
0 155
下载积分: 2 下载次数: 1

代码说明:

Android Paint画一个方框矩形,要使用到触笔事件及线程的相关操作,绘制绿色实心矩形和黄色的方框矩形:   /* 同样是设置颜色 */   mPaint.setColor(Color.rgb(255, 0, 0));   /* 提取颜色 */   Color.red(0xcccccc);   Color.green(0xcccccc);   /* 设置paint的颜色和Alpha值(a,r,g,b) */   mPaint.setARGB(255, 255, 0, 0);   /* 设置paint的Alpha值 */   mPaint.setAlpha(220);   /* 这里可以设置为另外一个paint对象 */   // mPaint.set(new Paint());   /* 设置字体的尺寸 */   mPaint.setTextSize(14);   // 设置paint的风格为“空心”.   // 当然也可以设置为“实心”(Paint.Style.FILL)   mPaint.setStyle(Paint.Style.STROKE);   // 设置“空心”的外框的宽度。   mPaint.setStrokeWidth(5);   /* 得到Paint的一些属性 */   Log.i(TAG, "paint的颜色:" + mPaint.getColor());   Log.i(TAG, "paint的Alpha:" + mPaint.getAlpha());   Log.i(TAG, "paint的外框的宽度:" + mPaint.getStrokeWidth());   Log.i(TAG, "paint的字体尺寸:" + mPaint.getTextSize());   /* 绘制一个矩形 */   // 肯定是一个空心的举行   canvas.drawRect((320 - 80) / 2, 20, (320 - 80) / 2 + 80, 20 + 40, mPaint);   /* 设置风格为实心 */   mPaint.setStyle(Paint.Style.FILL);   mPaint.setColor(Color.GREEN);   /* 绘制绿色实心矩形 */

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • android_rinex-master
    说明:  把GNSSLogger获取到的原始数据文件转换为rinex格式的数据文件。(Convert the raw data files obtained by GNSSLogger to rinex format data files.)
    2021-05-08 15:48:35下载
    积分:1
  • Android
    Android开发指南中文版,特别收藏版(Chinese version of Android Development Guide, Special Collections Edition)
    2011-06-01 11:27:22下载
    积分:1
  • baofengyingyin
    说明:  A UI project source code that imitates storm video and audio. The imitated interface includes menu pages, home pages, classification pages, etc. The local analog data used for all data in the project. The imitated degree will be problematic in layout and display on high-resolution devices. The resolution of 480 x 800 should be just right.
    2020-06-15 22:40:02下载
    积分:1
  • AnnotationTypeMismatchException
    Indicates that an annotation type has changed since it was compiled or serialized for Andriod.
    2013-10-13 18:02:04下载
    积分:1
  • android消息推送,包括客户端和服务端程序
    android消息推送,包括客户端和服务端程序
    2022-01-25 16:32:39下载
    积分:1
  • ZXingDemo
    Android系统使用Zxing库生成二维码,扫描二维码(the generation and scanning of the two-dimensional code )
    2020-09-25 16:27:47下载
    积分:1
  • android button例子分析
    1. android 界面开发之button开发的详细讲解,里面源代码已经包括了button的主要操作。 2. 包括button的各种属性,各种你平时很难见到的属性,告诉你原来button还可以这么用。
    2023-01-30 23:55:03下载
    积分:1
  • DERNull
    A NULL object Source Code for Andriod.
    2014-01-01 21:21:31下载
    积分:1
  • android系统电话、短信监听
    资源描述Android系统中,监听电话的状态,获取通话内容,监听短信数据库,获取接受、发送的短信
    2022-08-11 06:39:17下载
    积分:1
  • Android 通讯录
    通过SQLIITE数据库实现对联系人的增删改查,布局不好看,数据库已封装好,可以直接调用
    2023-05-08 22:35:03下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载