I am using a relative layout with height as wrap content . When i put a large drawable as its background,instead of taking the child height,the relative layout takes the height of the drawable,which is added as background. When i use color,there is no problem in height of the layout. How i can avoid the extra height of the background image?
Asked
Active
Viewed 108 times
1
-
Please post the drawable file. – ZInj Sep 19 '14 at 05:41
-
http://stackoverflow.com/a/8292110/1777090. You would need to make images of correct size. – MysticMagicϡ Sep 19 '14 at 05:41
-
@ZInj It is an image drawable,not a xml drawable – Anu Sep 19 '14 at 05:47
-
check this link: http://stackoverflow.com/q/18312414/3602047 – Metehan Sep 19 '14 at 05:55
-
You need to maintain separate drawables – VVB Sep 19 '14 at 06:25
1 Answers
0
int width = child.getwidth();
int height = child.getheight();
RelativeLayout.LayoutParams parms = new RelativeLayout.LayoutParams(width, height);
myRelativelayout.setLayoutParams(parms);

Galmani
- 71
- 7