I am using a ImageButton which will have an Image as background which i am getting dynamically at run time through code.Now i want to set a play image above the previous image so that both should be visible.Any help will be greatly appreciated.Thanks
Asked
Active
Viewed 1,523 times
0
-
i dont get understand can you more elaborate? – Nikunj Patel Sep 12 '11 at 10:27
-
Ya.I am using imagebutton which is having background image which i have added through code and not by xml.In the same imagbutton i want android default play button to be above that previous image so that both should be visible.U might have seen normally this kind of thing in youtube videos and all.Video behind and play button above that image.Thanks – Narayanan S Sep 12 '11 at 10:31
-
Im use for first image - setBackground, and then for second - setImageResource. This work for me ) – stannums Jul 23 '15 at 11:56
2 Answers
0
Try adding your image as Background and the image you want above it as source.

superM
- 8,605
- 8
- 42
- 51
-
Ya.Thanks i have tried it.It is working if i give it both in xml.But its not working when one through code and other through xml.Moreover there is no api,i can find for setsource for imagebutton through code. – Narayanan S Sep 12 '11 at 10:34
-
One of this depending what image u use: imageView.setImageBitmap(bm); imageView.setImageDrawable(drawable); imageView.setImageResource(R.id.my_res_id); – superM Sep 12 '11 at 10:40
0
You will need to merge images:
public static Bitmap mergeBitmaps(Bitmap original, Bitmap overlay) {
Bitmap result = Bitmap.createBitmap(original.getWidth(), original
.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(result);
Paint paint = new Paint();
paint.setAntiAlias(true);
canvas.drawBitmap(original, 0, 0, paint);
canvas.drawBitmap(overlay, 0, 0, paint);
return result;
}

Peter Knego
- 79,991
- 11
- 123
- 154
-
Thanks Peter.Will check.Can u see this link give me some solution. http://stackoverflow.com/questions/7383383/want-to-get-datas-depending-upon-the-current-system-time.I urgently needed this. – Narayanan S Sep 12 '11 at 10:47