Android 设计具有梯度的透明玻璃条
我正试图设计一个透明的玻璃型酒吧像这样- 我不擅长设计。我怎样才能做到这一点。有什么财产吗Android 设计具有梯度的透明玻璃条,android,android-layout,gradient,Android,Android Layout,Gradient,我正试图设计一个透明的玻璃型酒吧像这样- 我不擅长设计。我怎样才能做到这一点。有什么财产吗 提前感谢请确保使用RelativeLayout来放置工具栏和主体。 将工具栏放在最后一个位置。 为android设置透明颜色:工具栏的背景属性 这是工作代码的一个示例: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andr
提前感谢请确保使用RelativeLayout来放置工具栏和主体。 将工具栏放在最后一个位置。 为android设置透明颜色:工具栏的背景属性 这是工作代码的一个示例:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"
android:orientation="vertical">
<fragment
android:id="@+id/fragment_editor"
android:name="ichsan.myapp.HelloFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_editor" />
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="#10000000"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
</RelativeLayout>
玻璃样式的背景比简单的透明度要复杂一些。你可能想用。因此,实现这一点的方法是使用一个简单的白色图像,执行内部模糊->将模糊的输出位图设置为工具栏的背景。现在将alpha设置为0.6f左右,您将得到类似的结果。它与您提供的图像并不完全相同,但可能是获得类似效果的最简单方法