Reputation: 1500
I'm trying to set position to view at activity start.
I found out that the most of my problems was about getting layout coordinates in onCreate method, so I wrote it in onWindowFocusChanged, coordinates aren't 0s, so I now can set position of view with layout() method.
I did it, but view didn't update its position. By the way, in my log view has new position.
I think there is a method which should update view, give me a hint, please.
Thanks in advance.
Upvotes: 0
Views: 1826
Reputation: 3966
you can get layout params by using getLayoutParams()
and the change margin then again set layout param.
RelativeLayout.LayoutParams param = View.getLayoutParams();
set margins in your param according to your new position.
View.setLayoutParams(param)
.
If it is not solving your problem then please respond me so that I can try something else
Upvotes: 2