I have an Activity with relative layout on whole screen. In left top corner I have button. And on button click I want move layout from 0 X coord to 100 X coord. I tried something like this in onclick method:
RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
param.leftMargin = 100;
meRelativeLayout.setLayoutParams(param);
But this thing just made my relative layout width smaller, its change left margine and thats it, but I don’t want to change layout width, just want to change X coord, is there any way to do that?
To me your code seems to be perfect, only the matter is of
FILL_PARENT. As you usedFILL_PARENTthen the system will assign the space left in the display(less margin) thats why you layout became small, So Try this.