I have an image which i draw part of it with some condition.I want to resize drawable according to screen width then set bounds and draw image.Here is my code..
Code:
int value;
Drawable drawable = context.getResources().getDrawable(R.drawable.black);
Bitmap img = Bitmap.createBitmap(X_WIDTH, 50, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(img);
//resize drawable here according to screen width
drawable.setBounds(-value * X_WIDTH, 0, -value * X_WIDTH + X_WIDTH*13, 50);
drawable.draw(canvas);