开发者

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).

QuickAction in Widget

(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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜