I have a button that must show a popup window. And the popup window must be aligned with the right side of the button. That\'s how I do it.
button.setOnClick
The easiest way I've found is to specify the x-offset parameter:
final View view = popup.getContentView();
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
popup.showAsDropDown(button, button.getWidth() - view.getMeasuredWidth(), 0);
You can try to change it from the xml file:
android:layout_graviry="left"