如何使不透明工具栏项目的透明工具栏

问题描述:

如何使透明自定义工具栏具有可见的工具栏项目? 我有一个回收站视图的页面,我想看到我的recyclerview下我的透明工具栏与可见的工具栏项目。 它应该看起来像这样像this如何使不透明工具栏项目的透明工具栏

试试这个

<android.support.v7.widget.Toolbar 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/toolbar" 
android:layout_width="match_parent" 
android:layout_height="?attr/actionBarSize" 
android:background="@drawable/background_toolbar" /> 

现在创建一个资源background_toolbar.xml/drawble

<?xml version="1.0" encoding="utf-8"?> 

<shape 
xmlns:android="http://schemas.android.com/apk/res/android"> 

<gradient 
    android:angle="270" 
    android:endColor="@android:color/transparent" 
    android:startColor="#66000000"/> 
</shape> 

现在设置你的工具栏

+0

@Nielsh Rathod,您的解决方案无法正常工作。奥基,再看看这里。我有一个recyclerview的页面,所以我想看看我的透明工具栏下的mine recyclerview。 – Vaniusha

+0

添加你全屏与quetion我没有得到你 –

+0

再次检查我的问题。我做了编辑 – Vaniusha

设置工具栏:

<android.support.v7.widget.Toolbar 
     android:id="@+id/tbsobre" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="@android:color/transparent" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>