android设置toolbar(相当于标题栏)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ff000000"
    tools:context=".view.USBCameraActivity"
    tools:ignore="MergeRootFrame">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:navigationIcon="@null"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
  •   在代码中设置 setSupportActionBar(mToolbar);
  •  mToolBar 
    //    @BindView(R.id.toolbar)
    // public Toolbar mToolbar;

猜你喜欢

转载自www.cnblogs.com/endian11/p/9967479.html