Toolbar的简单使用--------(模拟器项目的标题)

(一)布局
<android.support.v7.widget.Toolbar
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"       //高使用系统固定的
    app:contentInsetStart="0dp"                      //使布局中文字居中
    android:background="@color/colorAccent">

    //布局中必须加上TextView-----(标题)
    <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="首页"
            android:textColor="@android:color/white"
            android:textSize="22sp" />
</android.support.v7.widget.Toolbar>

猜你喜欢

转载自blog.csdn.net/H_BuilDer/article/details/81481751