I created a button field in an XML file:
<RelativeLayout...> <Button android:id="@+id/button_1" ... /> <Button android:id="@+id/button_2" android:layout_toRightOf="@+id/button_1" ... /> ... </RelativeLayout>enter code here
Now I want to cancel the XML rule "toRightOf" programmaticaly. I know how to set the rules:
RelativeLayout.LayoutParams params = null; params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.RIGHT_OF, topIcon.getId()); button_2.setLayoutParams(params);
But I want to DELETE the rules that I set in the XML file. How can I do that?
Background of my question: I easily used an XML file to create a button field. But later I want to drag the buttons. To do this, I need to remove rules such as "toRightOf". Otherwise, instead of one button, move a lot of buttons if I only want to move one button.
source share