我一直试图使我的工具栏变得半透明并覆盖主要活动内容。截至目前,工具栏背景变为白色背景。有人可以告诉我我在这里想念的东西吗? 下面是MainActivity
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
tools:context="com.netbigs.apps.moviesat.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/container_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
</LinearLayout>
<RelativeLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/colorPrimary"
android:choiceMode="singleChoice"
android:divider="@android:color/background_dark"
android:dividerHeight="1dp" >
</ListView>
</android.support.v4.widget.DrawerLayout>
Toolbar.xml
<?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="match_parent"
android:id="@+id/toolbar"
android:background="@null>
答案 0 :(得分:0)
只需将以下几行添加到您的android活动样式中即可:
<item name="colorPrimary">@android:color/transparent</item>
<item name="windowActionBarOverlay">true</item>