代码中设立布局属性

代码中设置布局属性
RelativeLayout.LayoutParams rl=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);

rl.setMargins(30,0,0,0);

button.setLayoutParams(rl);