Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 90fa854

Browse files
committed
popupmenu show with offset
1 parent 1e11095 commit 90fa854

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

app/src/main/java/de/dlyt/yanndroid/oneuiexample/MainActivity.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,7 @@ public void standardDialog(View view) {
274274

275275
PopupMenu popupMenu = new PopupMenu(view);
276276
ArrayList<String> list = new ArrayList<>();
277-
for (int i = 0; i < 4; i++) {
278-
list.add("Menu Item " + i);
279-
}
280-
277+
for (int i = 0; i < 4; i++) list.add("Menu Item " + i);
281278
popupMenu.inflate(list);
282279
popupMenu.setOnMenuItemClickListener((parent, view1, position, id) -> {
283280
popupMenu.dismiss();

yanndroid/oneui/src/main/java/de/dlyt/yanndroid/oneui/view/PopupMenu.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ public void show() {
6464
popupWindow.showAsDropDown(anchor);
6565
}
6666

67+
public void show(int xoff, int yoff) {
68+
popupWindow.showAsDropDown(anchor, xoff, yoff);
69+
}
70+
6771
public void dismiss() {
6872
popupWindow.dismiss();
6973
}

0 commit comments

Comments
 (0)