How to set layout_alignParentRight="false" programmatically? [duplicate]
Asked Answered
A

1

14

How to set android:layout_alignParentRight="false" programmatically? I can set it to true by this code but I want to set it to false programmatically:

RelativeLayout.Layoutparams params =
(RelativeLayout.LayoutParams)myView.getLayoutParams();
params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
button.setLayoutParams(params);

There is a method removeRule(int) but it's added in (API level 17). I want to use something like this in API level 7 or 8.

Artwork answered 5/4, 2013 at 19:19 Comment(2)
#5108240Danette
thanks works with this: addRule(RelativeLayout.ALIGN_PARENT_RIGHT,0)Artwork
A
35

this code will set it false:

addRule(RelativeLayout.ALIGN_PARENT_RIGHT,0)
Artwork answered 5/4, 2013 at 19:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.