Tosin Onikute
Tosin Onikute

Reputation: 4002

Android - How can I achieve this type of toolbar?

I notice this type of toolbar used in recent apps on PlayStore, and I need to achieve this.

enter image description here

I know how to create a simple toolbar in XML.

Simple Toolbar

<android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:background="@color/ColorPrimary"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            android:theme="@style/about_toolbar"
            >
... 

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

I seems like a toolbar with padding.

So I'm not entirely sure. Please can someone who has done this help me out !

Upvotes: 1

Views: 115

Answers (1)

Fabio Venturi Pastor
Fabio Venturi Pastor

Reputation: 2529

Example with cardView:

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#bcbcbc"
        >
        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:layout_alignParentTop="true"
            android:layout_margin="20dp"
            android:background="@android:drawable/dialog_holo_light_frame"
            />
    </RelativeLayout>

enter image description here

Upvotes: 2

Related Questions