Java 如何将位图图像转换为可绘制图像,以便在另一个位图图像上显示
我有一个扩展视图的类……在这个类中,我有两个位图图像,一个显示在另一个上面……为此,我尝试将一个位图图像转换为可绘制图像,但它无法在第一个位图图像上显示我正在尝试的内容……Java 如何将位图图像转换为可绘制图像,以便在另一个位图图像上显示,java,android,Java,Android,我有一个扩展视图的类……在这个类中,我有两个位图图像,一个显示在另一个上面……为此,我尝试将一个位图图像转换为可绘制图像,但它无法在第一个位图图像上显示我正在尝试的内容…… public class ShowCanvas extends View { Bitmap CanvasBitmap; Bitmap ScaledBitmap; Bitmap smallbitmap; private static final int INVALID_POINTER_ID = -1; private Dr
public class ShowCanvas extends View {
Bitmap CanvasBitmap;
Bitmap ScaledBitmap;
Bitmap smallbitmap;
private static final int INVALID_POINTER_ID = -1;
private Drawable mImage;
private float mPosX;
private float mPosY;
private float mLastTouchX;
private float mLastTouchY;
private int mActivePointerId = INVALID_POINTER_ID;
private ScaleGestureDetector mScaleDetector;
private float mScaleFactor = 1.f;
public ShowCanvas(Context context) {
super(context);
// TODO Auto-generated constructor stub
ScaledBitmap = DrawView.scaled;
**when i get the image from drawable it shows over the first one...**
mImage=getResources().getDrawable(R.drawable.dress01)
但是当我使用它时,它会显示图像…
public class ShowCanvas extends View {
Bitmap CanvasBitmap;
Bitmap ScaledBitmap;
Bitmap smallbitmap;
private static final int INVALID_POINTER_ID = -1;
private Drawable mImage;
private float mPosX;
private float mPosY;
private float mLastTouchX;
private float mLastTouchY;
private int mActivePointerId = INVALID_POINTER_ID;
private ScaleGestureDetector mScaleDetector;
private float mScaleFactor = 1.f;
public ShowCanvas(Context context) {
super(context);
// TODO Auto-generated constructor stub
ScaledBitmap = DrawView.scaled;
**when i get the image from drawable it shows over the first one...**
mImage=新的BitmapDrawable(getResources(),Dress.bitmap)
}
使用此选项将位图图像转换为可绘制图像
使用此选项将位图图像转换为可绘制图像
Drawable d =new BitmapDrawable(bitmap);