Sunday, March 18, 2012

[android-developers] Window, WindowManager, PolicyManager classes - or - implementing a custom overlay

I'm creating a component that needs to appear above (and separate from) the existing UI, similar to the Dialog, PopupWindow and ContextMenu widgets.  I'd like it to be modular and portable (again like those widgets I just mentioned), so pre-supposing a particular type of layout for the Activity's contentView isn't realistic.  The component is similar in function to iOS's ActionSheet (I should stress "similiar" - I'm not trying for a direct port or emulation).

Using the PopupWindow class I got close, but haven't found a way to animate outside of setAnimationStyle which requires an XML animation resource (which I'd like to avoid).  I figured it wouldn't take a direction startAnimation invocation, but did think that I could use programmatic animations on the contentView or child views, but those fail without errors as well.

In looking at the source for the Dialog and PopupWindow classes, it looks like they accomplish this using the Window and WindowManager classes, but I'm not able to find much in the way of documentation on them.  In trying to clone Dialog and PopupWindow as a jumping-off point, I get errors - specifically as regards com.android.internal.policy.PolicyManager (which seems to be a core requirement, as the "window" is provided by the makeNewWindow method), which is entirely absent from the docs.

Is there a way to leverage the approach used in those classes to accomplish what I'm describing?  If not, is there another way?

TYIA.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate