AndroidLiquidGlassView
Less than 1 minute
AndroidLiquidGlassView
XML layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- content_container -->
<FrameLayout
android:id="@+id/content_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/images"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/image" />
</RelativeLayout>
</FrameLayout>
<!-- LiquidGlassView -->
<com.qmdeve.liquidglass.widget.LiquidGlassView
android:id="@+id/liquidGlassView"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerInParent="true" />
</RelativeLayout>Bind sampling source
Java
ViewGroup content = findViewById(R.id.content_container);
LiquidGlassView liquidGlassView = findViewById(R.id.liquidGlassView);
liquidGlassView.bind(content);kotlin
val content = findViewById<ViewGroup>(R.id.content_container)
val liquidGlassView = findViewById<LiquidGlassView>(R.id.liquidGlassView)
liquidGlassView.bind(content)API Reference
| Method | Description | Default Value |
|---|---|---|
bind(ViewGroup source) | Bind sampling source | - |
setCornerRadius(float px) | Set the corner radius (px) (0dp-99dp) | 40dp |
setRefractionHeight(float px) | Set the refraction height (px) (12dp-50dp) | 20dp |
setRefractionOffset(float px) | Set refraction offset (px) (20dp-120dp) | 70dp |
setTintColorRed(float red) | Set the red tone (0f-1f) | 1.0f |
setTintColorGreen(float green) | Set the green tone (0f-1f) | 1.0f |
setTintColorBlue(float blue) | Set the blue tone (0f-1f) | 1.0f |
setTintAlpha(float alpha) | Set Tint transparency (0f-1f) | 0.0f |
setDispersion(float dispersion) | Set the dispersion effect (0f-1f) | 0.5f |
setBlurRadius(float radius) | Set the blur radius (0dp-50dp) | 0f |
setDraggable(boolean enable) | Enable/disable drag-and-drop function | true |