Android PopupWindow that can be easily located relative to anchor View.
Extend RelativePopupWindow class and call showOnAnchor().
popup.showOnAnchor(anchor, VerticalPosition.ABOVE, HorizontalPosition.CENTER);
See detail example in ExampleCardPopup.kt or in Java, ExampleCardPopup.java.
- ABOVE
- ALIGN_BOTTOM
- CENTER
- ALIGN_TOP
- BELOW
- LEFT
- ALIGN_RIGHT
- CENTER
- ALIGN_LEFT
- RIGHT
If you want Popup not to fit in screen automatically, add parameter to disable it.
popup.showOnAnchor(anchor, VerticalPosition.ABOVE, HorizontalPosition.CENTER, false);
This library is available in jcenter.
- for AndroidX:
implementation 'com.labo.kaji:relativepopupwindow:0.4.1'
- for legacy Support Library:
implementation 'com.labo.kaji:relativepopupwindow:0.3.1'
MIT License.