0

I have a customView extending from TextureView. I want this customView to always align_parent_right.

My method inside customView has the following code:

RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams();
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
setLayoutParams(layoutParams);

However, customeView is still aligned left and not right. How can it be change to align right?

1pratham
  • 113
  • 1
  • 2
  • 9

1 Answers1

0

Add this way

RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams();
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
layoutParams.addRule(RelativeLayout.LEFT_OF, R.id.leftViewIdHere);
setLayoutParams(layoutParams);
Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95