zoukankan      html  css  js  c++  java
  • android 绘图的基本知识

    1。定义颜色的几种格式:A color value specifies an RGB value with an alpha channel, which can be used in various places such as specifying a solid color for a Drawable or the color to use for text. It always begins with a # character and then is followed by the alpha-red-green-blue information in one of the following formats: #RGB, #ARGB, #RRGGBB or #AARRGGBB.

    2。安卓中的原生资源:openRawResource()方法如此描述

    InputStream android.content.res.Resource.openRawResource(int id)

    Open a data stream for reading a raw resource. This can only be used with resources whose value is the name of an asset files -- that is, it can be used to open drawable, sound, and raw resources; it will fail on string and color resources.

     打开数据流去读原生资源,该方法仅用于读文件夹的名称为原生资源文件名的名称。也就是说, 它只能用于打开drawable,sound,raw资源文件夹,它不能打开string或者color资源。
    从这里看出res中的原生资源有三个drawable, sound,raw.【注1】
    3. paint.setAlpha(0x80);/设置颜色透明度为十六进制80(半透明),0x00全透明,0xFF

    【注1】android 中的资源文件asset与res
        今天发现,在创建一个Android工程的时候,和src源文件夹并列的有两个文件夹,分别是res和assets。这两个文件夹是用来保存资源文件的,然而在这两个资源文件中保存的文件有所不同。
        在assets中保存的文件一般是原生的文件,通常很少用到,例如一个MP3文件,Android程序不能直接访问,必须通过AssetManager类以二进制流的形式来读取。而Res文件夹中的资源可以通过R资源类直接访问,经常使用。同样在res文件夹下还有一个文件夹raw也是用来存放原生文件的。
        在android中使用Asset或者res/raw时都要经过Asset Manager,使用这两种资源提供方式时,必须要注意文件大小。经过调试发 现,Asset或者res/raw中的资源文件的UNCOMPRESS_DATA_MAX取值为1048576字节,也就是最大为未压缩1MB。否则会在logcat下看到获取到Debug类型的信息,04-09 02:48:51.220: DEBUG/asset(10734): Data exceeds UNCOMPRESS_DATA_MAX (1905341 vs 1048576)可以看到接下产生了一个系统的错误,System.err,会发生java.io.IOException的异常。

  • 相关阅读:
    单点登录cas常见问题(八)
    11G新特性 -- variable size extents
    11G新特性 -- ASM Fast Mirror Resync
    redhat 6.4 安装VirtualBox自动增强功能功:unable to find the sources of your current Linux kernel
    LINUX使用DVD光盘或者ISO作为本地YUM源
    数据库报ORA-00600: 内部错误代码, 参数: [17059],并产生大量trace日志文件
    Putty设置删除
    ssh/scp 远程连接ssh非默认端口方法
    查看LINUX版本
    RHCE7 -- systemctl命令
  • 原文地址:https://www.cnblogs.com/olvo/p/2474637.html
Copyright © 2011-2022 走看看