Thanks for your reply.I tried the new method arg0.drawBitmap(bitmap,
this.getBounds().left, this.getBounds().top, textPaint); but it not
works well ,my code is
public class BitmapText extends BitmapDrawable {
private String name;
private Bitmap bitmap;
public BitmapText(Context ctx,String strName,int bitmapId) {
// TODO Auto-generated constructor stub
super(BitmapFactory.decodeResource(ctx.getResources(),
bitmapId));
bitmap =BitmapFactory.decodeResource(ctx.getResources(),
bitmapId);
name = strName;
this.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
}
@Override
public void draw(Canvas arg0) {
// TODO Auto-generated method stub
Paint textPaint = new Paint();
arg0.drawBitmap(bitmap, this.getBounds().left,
this.getBounds().top,
textPaint);
textPaint.setTextSize(12);
textPaint.setTypeface(Typeface.DEFAULT);
textPaint.setAntiAlias(true);
textPaint.setStyle(Style.FILL);
arg0.drawText(name,10,10, textPaint);
}
}
call this class like BitmapText st = new BitmapText (view.getContext
(),"hello",R.drawable.android); Bitmap newBitmap = st.getBitmap();
The words "hello" is not painted in the new bitmap.Are there any
mistakes?Thank you very much.
Best Regards
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---