Change layout margin in Java code
변경하고자 하는 View가 들어가 있는 Layout형태의 LayoutParams 를 생성하고 그 안의 attributes 를 수정한 다음 다시 해당 View에 적용하면 된다.
FrameLayout.LayoutParams pl = (FrameLayout.LayoutParams)textInput.getLayoutParams();
pl.leftMargin = 260;
pl.topMargin = 82;
textInput.setLayoutParams(pl);
Comments