Ask Your Question
0

How can I display an Android view outside of the layout?

asked 2023-03-06 11:00:00 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-17 02:00:00 +0000

lalupa gravatar image

There are different approaches to displaying an Android view outside of the layout, depending on the context and purpose of the view. Here are some potential options:

  1. Create a floating view: This involves creating a new view that can be positioned outside of the layout, and adding it to the WindowManager using the WindowManager.LayoutParams.FLAGNOTFOCUSABLE and WindowManager.LayoutParams.FLAGNOTTOUCH_MODAL flags. This will allow the view to float over other views and receive touch events, without interfering with the underlying layout.

  2. Use a transparent activity/window: Another approach is to create a transparent activity or window, which can be positioned outside of the main layout bounds. This could be useful for displaying information that should be visible at all times, but not interfere with the main UI.

  3. Overlay view on top of app: You can use an Overlay view to display a view on top of the current app. The Overlay view can be positioned anywhere, roughly equivalent to floating views.

  4. Use WindowManager: You can use the WindowManager service to add a view programmatically outside of the layout.

It's worth noting that some of these approaches may have implications for the user experience or functionality of the app, so it's important to consider the context and use case carefully before implementing them.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-03-06 11:00:00 +0000

Seen: 9 times

Last updated: Jul 17 '21