I have tried to modify a Paint variable, but have been unsuccessful - how can I make a bitmap appear "semi-transparent"?
Using adjustOpacity , I make ImageView 's Bitmap be semi-transparent. Bitmap newBitmap = adjustOpacity(orignalBitmap, 10); view. setImageBitmap(newBitmap); view. setBackgroundColor(Color.
Use the Canvas method public void drawBitmap (Bitmap bitmap, Rect src, RectF dst, Paint paint) . Set dst to the size of the rectangle you want the entire image to be scaled into. EDIT: Here's a possible implementation for drawing the bitmaps in squares across on the canvas.
The parameter to onDraw() is a Canvas object that the view can use to draw itself. The Canvas class defines methods for drawing text, lines, bitmaps, and many other graphics primitives. You can use these methods in onDraw() to create your custom user interface (UI).
canvas.drawColor(Color.WHITE); BitmapDrawable bd = (BitmapDrawable) getResources().getDrawable(R.drawable.loading); Bitmap bm = bd.getBitmap(); Paint paint = new Paint(); paint.setAlpha(60); //you can set your transparent value here canvas.drawBitmap(bm, 0, 0, paint);
Paint p = new Paint(); p.setAlpha(70); Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.wallpaper); canvas.drawBitmap(image, xPosition, yPosition, p);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With