本文整理匯總了Java中android.graphics.drawable.BitmapDrawable.getIntrinsicHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java BitmapDrawable.getIntrinsicHeight方法的具體用法?Java BitmapDrawable.getIntrinsicHeight怎麽用?Java BitmapDrawable.getIntrinsicHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.drawable.BitmapDrawable
的用法示例。
在下文中一共展示了BitmapDrawable.getIntrinsicHeight方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: load
import android.graphics.drawable.BitmapDrawable; //導入方法依賴的package包/類
private void load(Context context, @DrawableRes int drawableRes, int textSize, String url) {
if (!nativeLoad(handle, url)) {
nativeClose(handle);
throw new RuntimeException("not gif");
} else {
frameNum = nativeGetFrameCount(handle);
for (int i = 0; i < frameNum; i++) {
BitmapDrawable drawable = new BitmapDrawable(context.getResources(), nativeGetFrame(handle, i));
int width = (textSize * drawable.getIntrinsicWidth()) / drawable.getIntrinsicHeight();
drawable.setBounds(0, 0, width, textSize);
EmoticonCache.saveDrawable(drawableRes, i, drawable);
delay = nativeGetDelay(handle, i);
}
nativeClose(handle);
}
}
示例2: updateScale
import android.graphics.drawable.BitmapDrawable; //導入方法依賴的package包/類
private void updateScale() {
Drawable d = getDrawable();
if(d instanceof BitmapDrawable) {
BitmapDrawable bd = (BitmapDrawable) d;
// Don't upscale if more than 2x larger
if (getWidth() > mMaxScale * bd.getIntrinsicWidth()
&& getHeight() > mMaxScale * bd.getIntrinsicHeight()) {
setScaleType(ScaleType.MATRIX);
Matrix trans = new Matrix();
Matrix scale = new Matrix();
trans.setTranslate((getWidth() - mMaxScale * bd.getIntrinsicWidth())/2, (getHeight() - mMaxScale * bd.getIntrinsicHeight())/2);
scale.setScale(mMaxScale, mMaxScale);
Matrix m = new Matrix();
if(isInEditMode()) {
// WTF? Edit mode consider inversed matrix??
m.setConcat(scale, trans);
}else {
m.setConcat(trans, scale);
}
setImageMatrix(m);
}else {
setScaleType(ScaleType.CENTER_CROP);
}
}
}