9

In 2021 Glass morphism UI is in trend. As a new android developer I want to add glass morphism effect in my android app so I search my query on google but I didn't get any answer to that how can I add glass morphism effect in my android app.

Should I have to write code for Glass Morphism effect or we can simply add through xml design.

Arjun Yadav
  • 101
  • 1
  • 6

3 Answers3

2

Glassmorphism effect is basically combination of blur and opacity. You can use one of many libraries for blur effect or you can write your own blur function. Then you can change the opacity of any view present in android both programmatically or in xml.

android:alpha="0.6"

You can checkout this link for blur libraries.

Dharman
  • 30,962
  • 25
  • 85
  • 135
0

For Developing side we can convert or add like Glass morphism or Soft Ui or any other . It is developed in Figma or Adobe Xd or any other with set of principles and design . After that we can get needed resources from designer then we use those resources in our App .

  • 4
    Please read [How to answer](https://stackoverflow.com/help/how-to-answer) and update your answer. – fartem Feb 14 '21 at 18:21
0

You can try article below. It use this library to create blur effect.Medium
dependency

implementation 'com.eightbitlab:blurview:1.6.6'

layout.xml
<eightbitlab.com.blurview.BlurView
    android:id="@+id/blur_view_tab"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    app:blurOverlayColor="@color/white_40">
    <com.google.android.material.tabs.TabLayout
        android:id="@+id/tab_main"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:tabMaxWidth="0dp"
        app:tabGravity="fill"
        app:tabMode="fixed"
        app:tabIndicatorColor="@color/black"
        android:minHeight="?actionBarSize"/>
</eightbitlab.com.blurview.BlurView>

then setup blur config in your activity

blurViewTab.setupWith(viewGroup)
        .setBlurAlgorithm(RenderScriptBlur(context))
        .setBlurRadius(16f)
        .setBlurAutoUpdate(true)
       .setHasFixedTransformationMatrix(true)

https://miro.medium.com/max/712/0*9Ns4U3PNxHGm9NLf.png
PAm
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – amit Feb 19 '22 at 12:14
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31109551) – Abhishek Dutt Feb 25 '22 at 05:37