天天看點

Android API 中文 (112) —— ThumbnailUtils

正文

一、結構

public class ThumbnailUtils extends Object

java.lang.Object

android.media.ThumbnailUtils

  二、概述

    為媒體生成正常縮略圖。(Android123:該類為Android2.2新增類,可以幫助我們從mediaprovider中擷取系統中的視訊或圖檔檔案的縮略圖)

  三、常量

  public static final int OPTIONS_RECYCLE_INPUT

           常量值:2 (0x00000002)

  四、公共方法

  public static Bitmap createVideoThumbnail (String filePath, int kind)

  建立一張視訊的縮略圖。如果視訊已損壞或者格式不支援可能傳回null。

  參數

  filePath  視訊檔案路徑

  kind          可以為MINI_KIND 或MICRO_KIND

  public static Bitmap extractThumbnail (Bitmap source, int width, int height, int options)

  建立所需尺寸居中縮放的位圖。

  source     原始位圖源

  width       目标寬

  height     目标高

options  在縮略圖抽取時提供的選項

  public static Bitmap extractThumbnail (Bitmap source, int width, int height)

  五、補充 

  文章連結

本文轉自over140 51CTO部落格,原文連結:http://blog.51cto.com/over140/582370,如需轉載請自行聯系原作者

繼續閱讀