文档介绍:AndroidUI开发专题(一)之界面设计近期很多网友对Android用户界面的设计表示很感兴趣,对于AndroidUI开发自绘控件和游戏制作而言掌握好绘图基础是必不可少的。本次专题分10节来讲述,有关OpenGLES相关的可能将放到以后再透露。本次主要涉及以下四个包的相关内容: 、 ,一起来看看SDK上是怎么介绍的吧,essingapplicationresources,suchasrawassetfiles,colors,drawables,mediaorotherotherfilesinthepackage,plusimportantdeviceconfigurationdetails(orientation,inputtypes,etc.)、颜色colors、图形drawables和多媒体文件media的相关资源均通过该类来管理。 intgetColor(intid)对应res/values/ DrawablegetDrawable(intid)对应res/drawable/ XmlResourceParsergetLayout(intid)对应res/layout/ StringgetString(intid)和CharSequencegetText(intid)对应res/values/ InputStreamopenRawResource(intid)对应res/raw/ voidparseBundleExtra(StringtagName,AttributeSetattrs,BundleoutBundle)对应res/xml/ String[]getStringArray(intid)res/values/ floatgetDimension(intid)res/values/ 二、 作为位图操作类,Bitmap提供了很多实用的方法,常用的我们总结如下: press(pressFormatformat,intquality,OutputStreamstream)压缩一个Bitmap对象根据相关的编码、画质保存到一个OutputStream中。其中第一个压缩格式目前有JPG和PNG voidcopyPixelsFromBuffer(Buffersrc)从一个Buffer缓冲区复制位图像素 voidcopyPixelsToBuffer(Bufferdst),当然他们使用的是APILevel均为1,,所以大家可以放心使用。 staticBitmapcreateBitmap(Bitmapsrc) staticBitmapcreateBitmap(int[]colors,intwidth,intheight,) staticBitmapcreateBitmap(int[]colors,intoffset,intstride,intwidth,intheight,) staticBitmapcreateBitmap(Bitmapsource,intx,inty,intwidth,intheight,Matrixm,booleanfilter) staticBitmapcreateBitmap(intwidth,intheight,) staticBitmapcreateBitmap(Bitmapsource,intx,inty,intwidth,intheight) staticBitmapcreateScaledBitmap(Bitmapsrc,intdstWidth,intdstHeight,booleanfilter)//创建一个可以缩放的位图对象 finalintgetHeight()获取高度 finalintgetWidth()获取宽度 finalbooleanhasAlph