I want set these attribute programmatically :-
android:layout_toEndOf="@+id/imageView1"
android:layout_toRightOf="@+id/imageView1"
The parent of the View has to be a RelativeLayout of course. Then you can do
final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.RIGHT_OF, R.id.imageView1);
params.addRule(RelativeLayout.END_OF, R.id.imageView1);
and call
view.setLayoutParams(params);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With