user2487729
user2487729

Reputation:

How can i move items programmatically on the screen?

I have an image with an item in the lower left. I would like at the bottom center, and not attached at the lower end but slightly raised. How can I do? Working with some of the calculations on the size of the screen? Obviously I mean in code, not xml. thanks

Upvotes: 0

Views: 438

Answers (1)

have a look at LayoutParams.

for exmaple

RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
Button button1;
button1.setLayoutParams(params);

you can do all differnt alignments, params, margins and padding as in xml

Upvotes: 2

Related Questions