[TIMOB-26769] Android: Add parity with Ti.UI.iOS.MenuPopup using the PopupMenu API
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | None |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Android |
| Labels | n/a |
| Reporter | Hans Knöchel |
| Assignee | Unknown |
| Created | 2019-01-26T10:18:57.000+0000 |
| Updated | 2019-01-26T15:11:49.000+0000 |
Description
This ticket is about adding support the
MenuPopup API on Android, which is currently iOS only via Ti.UI.iOS.MenuPopup. It can be done by using the native [PopupMenu](https://developer.android.com/reference/android/widget/PopupMenu) API.
PR: https://github.com/appcelerator/titanium_mobile/pull/10652 Example:
var win = Ti.UI.createWindow({ backgroundColor: "#fff", }); var button = Ti.UI.createButton({ title: "Show options" }); win.add(button); var menu = Ti.UI.createMenuPopup({ items: ["Option 1", "Option 2"] }); menu.addEventListener("click", function(e) { alert(e); }); button.addEventListener("click", function() { menu.show({ view: button }); }); win.open();