However, if there is not enough space below the view to display the PopupWindow, it will be displayed above the anchor view instead. When we display this content in a pop-up anchored to a view, by default the PopupWindow will display just below the view, left-aligned. Following listing (file res/layout/popup.xml) constructs a simple group of views that will be the content of our PopupWindow. In order to draw content on top of our view hierarchy, we first need to create the content to display. Those objects will be drawn on top of the corresponding view as long as their bounds are within the bounds of the parent. ViewOverlay allows you to add any number of Drawable objects to a private layer managed by the parent view. PopupWindow can have their own layout and can be set after inflating with setContentView(View).įrom API level 18 and onward you can use the newer ViewOverlay to draw content on top of your views. It’s a floating container that appears on top of current activity. PopupWindow is used to show floating view on display at specified position, but without inserting or otherwise modifying the existing view hierarchy. PopupWindow can be shown anywhere onscreen, either by providing an explicit location or by providing an existing view that the PopupWindow should be anchored to. How to draw over view content via PopupWindow in Android Android įrom API level 1 and onward you can place your content into a PopupWindow, which is a new temporary window in which you can place views that will be displayed on top of the current activity window.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |