通用标题栏

<LinearLayout android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <android.support.v7.widget.Toolbar
        android:id="@+id/tobar"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="#ffffff"
        android:contentInsetLeft="0dp"
        app:contentInsetStart="0dp"
        android:paddingTop="20dp"
        android:backgroundTint="#ff3300"
        >


        <ImageView
            android:id="@+id/back"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:layout_marginLeft="10dp"
            android:src="@mipmap/ic_launcher" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="返回"
            android:layout_marginLeft="10dp"
            />

        <TextView
            android:id="@+id/tv_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_gravity="center"
            android:text="我的足迹"
            android:textColor="#000000"
            android:textSize="16sp"
            />


        <TextView
            android:id="@+id/tv_edit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dp"
            android:layout_gravity="right|center_vertical"
            android:text="编辑"
            android:textColor="#333333"
            android:textSize="14sp"
            />


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

</LinearLayout>

在需要的布局里include进去即可

<include layout="@layout/title_layout"></include>

根据自己的需求进行相应的修改。

猜你喜欢

转载自blog.csdn.net/ZhangXuxiaoqingnian/article/details/82346259