How to make transparent toolbar with not transparent toolbar items

167 Views Asked by At

how i can to make transparent custom toolbar with visible toolbar items? I have a page with recycler view and I want to see my recyclerview under mine transparent toolbar with visible toolbar items. It's should looks like this

2

There are 2 best solutions below

4
On BEST ANSWER

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

now create a background_toolbar.xml in res/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>

now set your toolbar

0
On

set toolbar like this:

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