[参考一篇博客进行修改](https://www.kotlintc.com/articles/1974?fr=sidebar)

添加依赖关系
implementation 'com.android.support:appcompat-v7:23.1.1'

更改主题
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

布局
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><android.support.v7.widget.Toolbarandroid:id="@+id/toolbar"android:layout_width="match_parent"android:layout_height="wrap_content"android:background="@android:color/darker_gray"><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="标题"android:textSize="20sp" /></android.support.v7.widget.Toolbar>
</FrameLayout>>

业务逻辑
toolbar.setLogo(R.mipmap.ic_launcher)

模拟器