简体   繁体   English

Android-如何实现此类工具栏?

[英]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. 我注意到在PlayStore的最新应用中使用了这种工具栏,我需要实现这一点。

在此处输入图片说明

I know how to create a simple toolbar in XML. 我知道如何用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 ! 请做过此事的人帮助我!

Example with cardView: 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>

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM