I have two images, and I need to put them one on another, that can be made using FrameLayout
, as I found in this answer. However, I need to set that layout as background to one of my tabTitle, how it can be done?
Asked
Active
Viewed 2,042 times
0

Community
- 1
- 1

Mickey Tin
- 3,408
- 10
- 42
- 71
1 Answers
2
You can do that programmatically,
myFrameLayout.setDrawingCacheEnabled(true);
myFrameLayout.buildDrawingCache();
Bitmap bitmap = myFrameLayout.getDrawingCache();
myAnotherLayout.setBackgroundDrawable(new BitmapDrawable(bitmap)));

Niko
- 8,093
- 5
- 49
- 85
-
can't figure out how to get this Framelayout from resources – Mickey Tin Mar 05 '13 at 10:46
-
What do you mean by "from resources" – Niko Mar 05 '13 at 11:13
-
http://stackoverflow.com/questions/15221967/android-get-reference-to-layout-in-code – Mickey Tin Mar 05 '13 at 11:21
-
@Niko I tried this got but bitmap size is as my Screen size , and framelayout height width are grater then screen – PriyankaChauhan Nov 02 '16 at 10:25
-
@pcpriyanka Thats is tricky case because platform draws only to visible rect. Also consuming such a large bitmap using this method may easily cause OOM. – Niko Nov 02 '16 at 10:30
-
@Niko what can I do for that? any idea ? – PriyankaChauhan Nov 02 '16 at 10:32
-
@Niko I am creating one app which include draw crop rotation and etc what I want to do is image edit and save as the original size and quality – PriyankaChauhan Nov 02 '16 at 10:34
-
@pcpriyanka you could dig into this library for some help: https://arthurhub.github.io/Android-Image-Cropper/ – Niko Nov 02 '16 at 10:59
-
@Niko just want to create bitmap of larger framelayout but it returing width of bitmap as screen size – PriyankaChauhan Nov 02 '16 at 11:01