如何使自定义工具栏像图像给出描述

时间:2017-02-10 17:51:32

标签: android android-layout android-studio android-toolbar

我是Android开发的新手。任何人都可以帮助我如何自定义工具栏,如下图所示

https://i.stack.imgur.com/R8yOn.png

1 个答案:

答案 0 :(得分:0)

<?xml version="1.0" encoding="utf-8"?>
<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="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorPrimary"
    android:minHeight="?attr/actionBarSize"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:contentInsetLeft="0dp"
    android:contentInsetStart="0dp"
    app:contentInsetLeft="0dp"
    app:contentInsetStart="0dp"
    android:contentInsetRight="0dp"
    android:contentInsetEnd="0dp"
    app:contentInsetRight="0dp"
    app:contentInsetEnd="0dp"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"


        >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Delivery Location"
            android:layout_gravity="center"
            android:textColor="#000"
            android:id="@+id/toolbar_title" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Jiwaji Ganj"
            android:layout_gravity="center"
            android:textColor="@color/tabUnselectedIconColor"
            android:id="@+id/toolbar_title_location" />
    </LinearLayout>