Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 800
812621 Avatar asked Apr 05 '13 19:04

812621


1 Answers

this code will set it false:

addRule(RelativeLayout.ALIGN_PARENT_RIGHT,0)
like image 132
812621 Avatar answered Nov 15 '22 15:11

812621