android用户界面设计 pdf,androidui开发专题(一)之界面设计.pdf

/cmdn/bbs/viewthread.php?tid=18736&page=1

#pid89255

Android UI 开发专题(一) 之界面设计

近期很多网友对Android 用户界面的设计表示很感兴趣,对于Android UI 开发自绘控件和游

戏制作而言掌握好绘图基础是必不可少的。本次专题分10 节来讲述,有关OpenGL ES 相关

的可能将放到以后再透露。本次主要涉及以下四个包的相关内容: android.content.res 资

源类

android.graphics 底层图形类

android.view 显示类

android.widget 控件类

一、android.content.res.Resources

对于Android 平台的资源类android.content.res.Resources 可能很多网友比较陌生,一起

来看看SDK 上是怎么介绍的吧,Contains classes for accessing application resources, such as

raw asset files, colors, drawables, media or other other files in the package, plus important device

configuration details (orientation, input types, etc.) that affect how the application may behave.平

时用到的二进制源文件raw 、颜色colors、图形drawables 和多媒体文件media 的相关资源均

通过该类来管理。

int getColor(int id) 对应res/values/colors.xml

Drawable getDrawable(int id) 对应res/drawable/

XmlResourceParser getLayout(int id) 对应res/layout/

String getString(int id) 和CharSequence getText(int id) 对应res/values/strings.xml

InputStream openRawResource(int id) 对应res/raw/

void parseBundleExtra (String tagName, AttributeSet attrs, Bundle outBundle) 对应res/xml/

String[] getStringArray(int id) res/values/arrays.xml

float getDimension(int id) res/values/dimens.xml

二、android.graphics.Bitmap

作为位图操作类,Bitmap 提供了很多实用的方法,常用的我们总结如下:

boolean compress(Bitmap.CompressFormat format, int quality, OutputStream stream) 压缩

一个Bitmap 对象根据相关的编码、画质保存到一个OutputStream 中。其中第一个压缩格式

目前有JPG 和PNG

void copyPixelsFromBuffer(Buffer src) 从一个Buffer 缓冲区复制位图像素

void copyPixelsToBuffer(Buffer dst) 将当前位图像素内容复制到一个Buffer 缓冲区

我们看到创建位图对象createBitmap 包含了6 种方法在目前的Android 2.1 SDK 中,当

然他们使用的是API Level 均为1,所以说从Android 1.0 SDK 开始就支持了,所以大家可以

放心使用。

static Bitmap createBitmap(Bitmap src)

static Bitmap createBitmap(int[] colors, int width, int height, Bitmap.Config config)

static Bitmap createBitmap(int[] colors, int o

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值