android_ui开发专题

android_ui开发专题

ID:15618262

大小:61.00 KB

页数:21页

时间:2018-08-04

android_ui开发专题_第1页
android_ui开发专题_第2页
android_ui开发专题_第3页
android_ui开发专题_第4页
android_ui开发专题_第5页
资源描述:

《android_ui开发专题》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、Android_UI开发专题本文由zj_w1231贡献AndroidUI开发专题AndroidUI开发专题(一)之界面设计近期很多网友对Android用户界面的设计表示很感兴趣,对于AndroidUI开发自绘控件和游戏制作而言掌握好绘图基础是必不可少的。本次专题分10节来讲述,有关OpenGLES相关的可能将放到以后再透露。本次主要涉及以下四个包的相关内容:  android.content.res资源类android.graphics底层图形类android.view显示类android.widget控件类一、android.content.res.Resou

2、rces对于Android平台的资源类android.content.res.Resources可能很多网友比较陌生,一起来看看SDK上是怎么介绍的吧,Containsclassesforaccessingapplicationresources,suchasrawassetfiles,colors,drawables,mediaorotherotherfilesinthepackage,plusimportantdeviceconfigurationdetails(orientation,inputtypes,etc.)thataffecthowtheappl

3、icationmaybehave.平时用到的二进制源文件raw、颜色colors、图形drawables和多媒体文件media的相关资源均通过该类来管理。intgetColor(intid)对应res/values/colors.xmlDrawablegetDrawable(intid)对应res/drawable/XmlResourceParsergetLayout(intid)对应res/layout/StringgetString(intid)和CharSequencegetText(intid)对应res/values/strings.xmlInputS

4、treamopenRawResource(intid)对应res/raw/voidparseBundleExtra(StringtagName,AttributeSetattrs,BundleoutBundle)对应res/xml/String[]getStringArray(intid)res/values/arrays.xmlfloatgetDimension(intid)res/values/dimens.xml二、android.graphics.Bitmap作为位图操作类,Bitmap提供了很多实用的方法,常用的我们总结如下:booleancompre

5、ss(Bitmap.CompressFormatformat,intquality,OutputStreamstream)压缩一个Bitmap对象根据相关的编码、画质保存到一个OutputStream中。其中第一个压缩格式目前有JPG和PNGvoidcopyPixelsFromBuffer(Buffersrc)从一个Buffer缓冲区复制位图像素voidcopyPixelsToBuffer(Bufferdst)将当前位图像素内容复制到一个Buffer缓冲区我们看到创建位图对象createBitmap包含了6种方法在目前的Android2.1SDK中,当然他们使用

6、的是APILevel均为1,所以说从Android1.0SDK开始就支持了,所以大家可以放心使用。staticBitmapcreateBitmap(Bitmapsrc)staticBitmapcreateBitmap(int[]colors,intwidth,intheight,Bitmap.Configconfig)staticBitmapcreateBitmap(int[]colors,intoffset,intstride,intwidth,intheight,Bitmap.Configconfig)staticBitmapcreateBitmap(Bit

7、mapsource,intx,inty,intwidth,intheight,Matrixm,booleanfilter)staticBitmapcreateBitmap(intwidth,intheight,Bitmap.Configconfig)staticBitmapcreateBitmap(Bitmapsource,intx,inty,intwidth,intheight)staticBitmapcreateScaledBitmap(Bitmapsrc,intdstWidth,intdstHeight,booleanfilter)//创建一个可以缩放的位

8、图对象finalintg

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。