Floating Pane Layout
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
The Context the view is running in, through which it can
Constructors
Functions
Adds a callback to be notified of floating pane events.
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.
Enters or exits the minimized view state for the floating pane.
Retrieves the current mode of the floating pane.
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.
Hides the floating pane.
Requests drawing of a resize rectangle with an optional animation.
Shows or hides the pre-docking effect.
Stops drawing all elements managed by this layout, such as the resize rectangle and pre-docking effect.
Sets the allowed modes for the floating pane.
Disables the blur effect on the pre-docking effect and the floating pane background.
Sets an animation listener for the hide animation of the floating pane.
Sets the maximum height for the floating pane in a specific mode.
Sets the maximum width for the floating pane in a specific mode.
Sets the minimum height for the floating pane in a specific mode.
Sets the view to be displayed when the floating pane is minimized.
Sets the custom width for the minimized state of the floating pane in a specific mode.
Sets the minimum width for the floating pane in a specific mode.
Sets the height of the result content for a specific floating pane mode.
Sets the background resource for the result view of the floating pane.
Sets the width of the floating pane for a specific mode.
Sets an animation listener for the show/hide animations of the floating pane in a specific mode.
Shows the floating pane.
Shows or hides the minimized icon with an animation.