美文网首页
替换toolbar的title_layout

替换toolbar的title_layout

作者: 今天也要努力呀y | 来源:发表于2019-09-25 20:05 被阅读0次
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:layout_marginTop="20dp"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
    app:contentInsetStart="0dp"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:id="@+id/open_nav"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_marginLeft="10dp"
            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"/>

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:textSize="18sp"
            android:textStyle="bold" />
    </RelativeLayout>

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

然后在activity中include一下
然后在java代码中设置样式即可

相关文章

网友评论

      本文标题:替换toolbar的title_layout

      本文链接:https://www.haomeiwen.com/subject/uvuwuctx.html