2017-07-17 118 views

回答

0

试试这个

<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

0

设置工具栏:

<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"/>