国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

Android UI開發專題(,一) 之界面設計

2019-11-02 14:38:27
字體:
來源:轉載
供稿:網友

   近期很多網友對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緩沖區

  我們看

可愛網名[www.la240.com/html2017/1/17/]
到創建位圖對象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 offset, int stride, int width, int height, Bitmap.Config config)

  static Bitmap createBitmap(Bitmap source, int x, int y, int width, int height, Matrix m, boolean filter)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 安庆市| 体育| 凤城市| 怀安县| 讷河市| 黑河市| 临海市| 彰化县| 松潘县| 施秉县| 行唐县| 苍南县| 甘谷县| 紫云| 崇文区| 彝良县| 太白县| 江安县| 宜昌市| 龙山县| 靖江市| 体育| 江西省| 虎林市| 邻水| 山阳县| 通山县| 图木舒克市| 锡林浩特市| 葫芦岛市| 驻马店市| 从化市| 丰都县| 香河县| 华蓥市| 长垣县| 通州市| 塔城市| 石泉县| 宁海县| 昌江|