QuickAction in Widget
I'd like to add a QuickAction-Bar to my Widget-Project like discussed here.
The problem is, that all those implementations need a View
as an anchor. But since I'm building a Widget, I only have RemoteViews
.
I checked the source of those implementations and did some research and I found that they all use the standard PopupWindow
-class (which is part of Android since API-Level 1). This class offers three methods to be shown and they all want a View
as a param开发者_如何学Pythoneter.
My question is, is there any workaround for that to make this UI-Pattern usable in a Widget? I know it does work since "SUI Call Log" and the "HTC Sense SMS-Widget" do it, too (But I cant get my fingers on source code of neither of them).
(source: suisolutions.com)The "HTC Sense SMS-Widget" may not be an app widget, but rather a feature of the home screen. Only if you are able to add it to an alternative home screen can you tell if it is an app widget or not.
Regardless, you could start up an activity that displays the quick action. Give it a transparent theme and pass any information you can via extras in terms of where to place the popup. Place a transparent 1px square View
at that location as your anchor, then use QuickContactBadge
or PopupWindow
or whatever you like.
精彩评论