FloatingPaneLayout

class FloatingPaneLayout @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0) : FrameLayout

A layout that allows a child view to be displayed as a floating pane that can be moved, resized, docked, or minimized.

It provides functionality for:

  • Displaying a child view as a floating pane.

  • Moving and resizing the floating pane.

  • Docking the floating pane to the sides or bottom of the screen.

  • Minimizing the floating pane to an icon.

  • Showing a pre-docking effect when the pane is dragged near a docking area.

  • Applying a blur effect to the background behind the pane (if supported).

To use FloatingPaneLayout, add it to your layout XML and then add your content view with the ID R.id.result_layout_content. You can optionally add a minimized view with the ID R.id.result_layout_minimize.

Example usage:

<com.google.android.material.oneui.floatingdock.FloatingPaneLayout
android:id="@+id/floating_pane_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
android:id="@id/result_layout_content"
android:layout_width="300dp"
android:layout_height="400dp"
android:background="@android:color/white">
<!-- Your content view here -->
</FrameLayout>

<ImageView
android:id="@id/result_layout_minimize"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/ic_minimize_icon" />

</com.google.android.material.oneui.floatingdock.FloatingPaneLayout>

You can control the behavior of the floating pane using methods like show(), hide(), enterMinimizeView(), and setAllowModes(). Callbacks can be registered via addCallback() to listen to pane state changes.

Parameters

context

The Context the view is running in, through which it can

Constructors

Link copied to clipboard
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, defStyleRes: Int = 0)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun addCallback(@NotNull callback: IFloatingPaneCallback)

Adds a callback to be notified of floating pane events.

Link copied to clipboard
fun addUntouchableAreaInset(left: Int, top: Int, right: Int, bottom: Int)

Sets an untouchable area inset for the floating pane when it's in floating mode. This allows defining a region around the floating pane where touch events will be ignored.

Link copied to clipboard
open override fun addView(child: View)
open override fun addView(child: View, params: ViewGroup.LayoutParams)
open override fun addView(child: View, index: Int)
open override fun addView(child: View, index: Int, params: ViewGroup.LayoutParams)
open override fun addView(child: View, width: Int, height: Int)
Link copied to clipboard
fun enterMinimizeView(minimize: Boolean)

Enters or exits the minimized view state for the floating pane.

Link copied to clipboard

Retrieves the current mode of the floating pane.

Link copied to clipboard

Retrieves the top limit size for the floating pane. This value typically corresponds to the height of the status bar or a similar top UI element, preventing the floating pane from overlapping with it.

Link copied to clipboard
fun hide(animate: Boolean = true)

Hides the floating pane.

Link copied to clipboard
Link copied to clipboard

Checks if the floating pane is currently showing.

Link copied to clipboard
open override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)
Link copied to clipboard

Requests drawing of a resize rectangle with an optional animation.

Link copied to clipboard
fun seslShowProDockingEffect(show: Boolean, dockingArea: Rect)

Shows or hides the pre-docking effect.

Link copied to clipboard

Stops drawing all elements managed by this layout, such as the resize rectangle and pre-docking effect.

Link copied to clipboard

Sets the allowed modes for the floating pane.

Link copied to clipboard
fun setBlurDisable(disable: Boolean)

Disables the blur effect on the pre-docking effect and the floating pane background.

Link copied to clipboard

Sets an animation listener for the hide animation of the floating pane.

Link copied to clipboard

Sets the maximum height for the floating pane in a specific mode.

Link copied to clipboard

Sets the maximum width for the floating pane in a specific mode.

Link copied to clipboard

Sets the minimum height for the floating pane in a specific mode.

Link copied to clipboard

Sets the view to be displayed when the floating pane is minimized.

Link copied to clipboard

Sets the custom width for the minimized state of the floating pane in a specific mode.

Link copied to clipboard

Sets the minimum width for the floating pane in a specific mode.

Link copied to clipboard
Link copied to clipboard

Sets the height of the result content for a specific floating pane mode.

Link copied to clipboard

Sets the background resource for the result view of the floating pane.

Link copied to clipboard

Sets the width of the floating pane for a specific mode.

Link copied to clipboard

Sets an animation listener for the show/hide animations of the floating pane in a specific mode.

Link copied to clipboard
fun show(animate: Boolean = true)

Shows the floating pane.

Link copied to clipboard
fun showMinimizedIcon(show: Boolean, skipAnimate: Boolean = false)

Shows or hides the minimized icon with an animation.