FloatingWindow
floating_window.FloatingWindow
Handle for one overlay window: position, size, content (View / XML), flags, and simple touch hooks.
Table of contents
Properties
Methods
Properties
isShowing
isShowing(read-only):boolean
Whether the window is currently visible on screen.
position
position(read-only):Point
Top-left corner in pixels.
size
size(read-only):Size
Width and height in pixels (or layout constants if you used them when sizing).
view
view?(read-only):any
Root View of the window content, or undefined until a view is set.
Methods
addFlags
addFlags(flags: number): void
Bitwise OR additional WindowManager.LayoutParams flags. Common presets in this module include FLAG_NOT_TOUCHABLE and FLAG_NOT_FOCUSABLE.
close
close(): Promise<void>
Hides and tears down the window. Resolves when the native window is released.
enableDrag
enableDrag(view: View, options?: DragGestureOptions ): DragGesture
Use view as the drag handle; returns a gesture controller for advanced drag tuning.
on
on(event: "touch", listener: (event: any) => void): FloatingWindow
Subscribe to touch events on the overlay (listener shape is runtime-specific).
removeFlags
removeFlags(flags: number): void
Clears the given flag bits from the current layout params.
setPosition
setPosition(x: number, y: number): Promise<void>
Moves the window to (x, y) in screen coordinates.
setSize
setSize(width: number, height: number): Promise<void>
Resizes the window in pixels.
setView
setView(view: View): void
Sets the root content to an existing View instance.
setViewFromXml
setViewFromXml(xml: string): void
Inflates UI XML from a string and attaches it as the root view.
setViewFromXmlFile
setViewFromXmlFile(xmlFile: string): Promise<void>
Loads XML from xmlFile, inflates it, and sets it as the root view.
show
show(): Promise<void>
Shows the window. From the background, Android may block overlays unless you hold SYSTEM_ALERT_WINDOW / display-over-other-apps permission and (on newer versions) an appropriate foreground service where required.
See also
