【发布时间】:2015-06-17 04:02:51
【问题描述】:
我想设置工具栏的背景透明。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
android:elevation="4dp"
android:id="@+id/tool_bar_org"
android:paddingTop="0dp">
</android.support.v7.widget.Toolbar>
这是我的工具栏布局背景不透明
只显示白色
toolbar = (Toolbar) findViewById(R.id.tool_bar_org);
toolbar.getbackgroud().setAlpha(0);
setSupportActionBar(toolbar);
它不工作。你能告诉我如何让它透明吗?
【问题讨论】:
-
您需要使用应用的主题/样式来做到这一点。
-
@Skynet 先生,请解释一下样式有什么变化
-
当我添加此代码
android:background="@android:color/transparent"。我的工具栏的背景是透明的。 -
@Cbibejs 但我的显示为白色...我想在工具栏下方显示图像
-
您的山峰图像有顶部填充还是位于工具栏下方?如果您将主布局的背景更改为山峰图像,则它应该在工具栏后面可见。
标签: android background transparent android-toolbar