I have a FrameLayout which contains 2 views , the second is something like a Close Button (X)
and i want to position it on the right.
I\'ve tried layout
Programatically, you can set the margin using FrameLayout.LayoutParams. The following would work to place a view on the bottom of your screen:
int desired_height_of_content = //whatever your want the height of your view to be
FrameLayout layout = new FrameLayout(this);
FrameLayout.LayoutParams flp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, desired_height_of_content);
int difference = screen_height - desired_height_of_content
flp.setMargins(difference, 0, 0, 0);
layout.addView(your_view, flp);