?
This document uses PHP Chinese website manual Release
ThumbnailUtils
版本:Android 3.0 r1
結(jié)構(gòu)
繼承關(guān)系
public class ThumbnailUtils extends Object
java.lang.Object
android.media.ThumbnailUtils
類概述
為媒體生成常規(guī)縮略圖。(Android123:該類為Android2.2新增類,可以幫助我們從mediaprovider中獲取系統(tǒng)中的視頻或圖片文件的縮略圖)
常量
public static final int OPTIONS_RECYCLE_INPUT
常量用于表示應(yīng)該回收extractThumbnail(Bitmap,
int, int, int)
輸入源圖片(第一個參數(shù)),除非輸出圖片就是輸入圖片。
常量值:2 (0x00000002)
公共方法
public static Bitmap createVideoThumbnail (String filePath, int kind)
創(chuàng)建一張視頻的縮略圖。如果視頻已損壞或者格式不支持可能返回null。
參數(shù)
filePath 視頻文件路徑
kind 可以為MINI_KIND 或MICRO_KIND
public static Bitmap extractThumbnail (Bitmap source, int width, int height, int options)
創(chuàng)建所需尺寸居中縮放的位圖。
參數(shù)
source 原始位圖源
width 目標(biāo)寬
height 目標(biāo)高
options 在縮略圖抽取時提供的選項
public static Bitmap extractThumbnail (Bitmap source, int width, int height)
創(chuàng)建所需尺寸居中縮放的位圖。
參數(shù)
source 原始位圖源
width 目標(biāo)寬
height 目標(biāo)高
補充
文章鏈接
ThumbnailUtils - Android2.2新增類 (Android123)
[推薦]Android縮略圖類源代碼 (Android123)