在2021年,玻璃形态UI将成为趋势。作为一个新的android开发人员,我想在我的android应用程序中添加玻璃形态效果,所以我在google上搜索我的查询,但我没有得到任何答案,我如何在我的android应用程序中添加玻璃形态效果。
我是否必须编写玻璃形态效果的代码,或者我们可以简单地通过xml设计添加。
发布于 2021-03-10 20:55:47
玻璃形态效果基本上是模糊和不透明的组合。您可以使用许多库中的一个来实现模糊效果,也可以编写自己的模糊函数。然后,您可以通过编程或xml更改android中存在的任何视图的不透明度。
android:alpha="0.6"你可以查看模糊库的this链接。
发布于 2021-02-15 00:21:46
对于开发端,我们可以转换或添加类似玻璃态射或软Ui或任何其他。它是用Figma或Adobe Xd或任何其他具有一套原理和设计的工具开发的。之后,我们可以从设计师那里获得所需的资源,然后在我们的应用程序中使用这些资源。
发布于 2022-02-19 10:58:30
你可以试试下面的文章。它使用此library创建模糊效果。Medium
依赖性
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>
然后在你的活动中设置模糊配置
blurViewTab.setupWith(viewGroup)
.setBlurAlgorithm(RenderScriptBlur(context))
.setBlurRadius(16f)
.setBlurAutoUpdate(true)
.setHasFixedTransformationMatrix(true)
https://stackoverflow.com/questions/66182723
复制相似问题