android位图上下翻译

时间:2013-07-29 07:44:05

标签: android bitmap

你好我是android编程新手,我想问一下如何用浮点输入上下翻译位图? 这是我的代码:

bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.horizonsx);
bmpWidth = bitmap.getWidth();
bmpHeight = bitmap.getHeight();
drawMatrix();

private void drawMatrix(){

Matrix matrix = new Matrix();
matrix.setTranslate(0,10);


  Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0,0, bmpWidth, bmpHeight, matrix, true);

 imageviewrot.setImageBitmap(resizedBitmap);
imageviewrot.setScaleType(ScaleType.CENTER); ///THIS WAS THE KEY LINE

}

但未能将位图翻译为值10.我怎么能这样做?谢谢

1 个答案:

答案 0 :(得分:0)

利用sprite s ...精灵将保存你的位图,然后我们可以在精灵上制作translation/rotation

here

获取一些提示