How to create custom Toolbar like Acmarket

Asked

Viewed 219 times

3

I want to create a Toolbar same as Acmarket, but I don’t intend to use CollapsingToolbar, I just want to create a similar Toolbar, someone help?

Apenas o layout da Toolbar

<android.support.v7.widget.Toolbar 
    xmlns: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"/>

2 answers

2

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

0

One option is to place your toolbar Toolbar within a CardView, so to distance a little from the edge, it is necessary to use the property layout_margin setting it the value you think best. Below follows an example using elevation of CardView in 8dp:

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

Imagery

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.