Reputation: 291
This problem is related to positioning objects on the screen. I have a dynamic creation of framelayout with layout params as given below
FrameLayout fl=new FrameLayout(getApplicationContext());
LayoutParams frameBounds=new FrameLayout.LayoutParams(500,500);
fl1.setLayoutParams(frameBounds);
Button b=newButton(this);
b.setMargins(0,0,200,200);
I tried this it works but my button tends to stick around top left corner. Is there any way to position the button by considering only the right and bottom values irrespective of the left and top values. In short i want the right corner of the button to be at a distance of 200 from the right corner of framelayout(500). Help PLZ...
Upvotes: 2
Views: 203
Reputation: 11930
You must set the gravity on bottom|right. Then, will put the margins 200.
Upvotes: 1