Skip to content Skip to sidebar Skip to footer

How To Place Imagebutton At X, Y Location?

I want to place ImageButton at x, y location of my view. The problem is that Android adds padding around image. Because I don't know exact size of padding, I cannot place image but

Solution 1:

EDIT

Use this...

MarginLayoutParamsmarginParams=newMarginLayoutParams(image.getLayoutParams());  
     intleft= someValue;
     inttop= someValue;
     marginParams.setMargins(left, top, 0, 0);
     RelativeLayout.LayoutParamslayoutParams=newRelativeLayout.LayoutParams(marginParams);
     image.setLayoutParams(layoutParams);   

Post a Comment for "How To Place Imagebutton At X, Y Location?"