How to create custom toolbar just like ACMarket

3

I want to create a Toolbar equal to ACMarket, but I do not want to use CollapsingToolbar , I just want to create a similar Toolbar, does anyone help?

<android.support.v7.widget.Toolbarxmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="fill_parent" 
    android:id="@+id/tool" 
    android:elevation="13dp" 
    android:layout_height="?actionBarSize" 
    android:background="@drawable/bg_action_bar_3" 
    app:theme="@style/Base.ThemeOverlay.AppCompat.Light" 
    app:popupTheme="@style/Base.ThemeOverlay.AppCompat.Light"/>
    
asked by anonymous 18.07.2016 / 15:42

2 answers

2

The secret is to put android: layout_margin="8dp" in the Toolbar. It will work in any layout.

    
13.12.2016 / 19:22
0

One option is to put your toolbar Toolbar within a CardView , so to distance yourself a bit from the border, it is necessary to use the layout_margin property setting it the value you think is best. Here is an example using% elevation% in CardView :

<android.support.v7.widget.CardView
    android:id="@+id/map_toolbar_container"
    android:layout_width="@dimen/whatever_you_want"
    android:layout_height="wrap_content"
    android:layout_margin="8dp"
    app:cardElevation="8dp"
    app:cardBackgroundColor="#324">

    <android.support.v7.widget.Toolbar
        android:id="@+id/wld_toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:minHeight="?attr/actionBarSize"/>

</android.support.v7.widget.CardView>

Image

    
29.09.2016 / 16:00