<ButtonBut how to set it dynamically in code?
...
android:layout_centerHorizontal="true"
...
/>
Here is the answer:
LayoutParams layoutparams = new LayoutParams(width, height);
layoutparams.addRule(RelativeLayout.CENTER_HORIZONTAL);
mButton.setLayoutParams(layoutParams);
No comments:
Post a Comment