使用Bitmap画一张自定义文字的图片

int w = 480,h = 800;
    	String title = "NNNNNNNNNNNNNNNN";
        Bitmap bm = Bitmap.createBitmap(w,h, Config.ARGB_8888);
        Canvas canvas = new Canvas(bm);
        canvas.drawColor(Color.WHITE);
        Paint p = new Paint();
        p.setColor(Color.RED);
        p.setTextSize(22);
        canvas.drawText(title,w/2,h/2,p);
        
        
        ImageView iv = (ImageView) findViewById(R.id.iv);
        iv.setImageBitmap(bm);


你可能感兴趣的:(String)