Was ich will, wird der Text mit der Fingerberührung über das Bild bewegt, auf der Schaltfläche klickt es das vorhandene Bild in eine neue neu gezeichnet, die als Text eingefügt wird.Verschieben von Text und Neuzeichnen des Bildes Geräteprobleme
es funktioniert gut für v3.1 sowie auf Emulator. aber ich habe versucht, auf v2.2 Gerät zu testen, tritt das forse Close.While hat alle Unterstützung für die Devices.Can helfen Sie mir hier raus. Es wird in wenigen Wochen entscheidend sein. Vielen Dank im Voraus.
///Redrawing the image & touchin Move of the Canvas with text
public void redrawImage(String path,float sizeValue,String textValue,int colorValue) {
BitmapFactory.Options options = new BitmapFactory.Options();
try {
options.inMutable = true;
} catch (Exception e) {
// TODO: handle exception
System.out.println("#############Error is======"+e.getMessage());
}
Bitmap bm = BitmapFactory.decodeFile(path,options);
proxy = Bitmap.createBitmap(bm.getWidth(), bm.getHeight(), Config.ARGB_8888);
Canvas c = new Canvas(proxy);
//Here, we draw the background image.
c.drawBitmap(bm, new Matrix(), null);
Paint paint = new Paint();
paint.setColor(colorValue); // Text Color
paint.setStrokeWidth(30); // Text Size
paint.setTextSize(sizeValue);
System.out.println("Values passing=========="+someGlobalXvariable+", "+someGlobalYvariable+", "
+sizeValue+", "+textValue);
//Here, we draw the text where the user last touched.
c.drawText(textValue, someGlobalXvariable, someGlobalYvariable, paint);
popImgae.setImageBitmap(proxy);
}
Können Sie das Fehlerprotokoll von logcat hochladen? – Zelleriation
options.inMutable = true; wird unterstützt seit: API Level 11, und Sie müssen Bitmap Bm nicht als Mutable laden. Nur der Bitmap-Proxy sollte veränderbar sein –