include布局
<include
android:id="@+id/tl_reg"
layout="@layout/layout_toolbar"/>
layout_toolbar.xml
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:titleTextColor="@color/secondary_text"
/>
</merge>
情况
1.用findViewById可以找到Toolbar,但是用ButterKnife找不到
2.将include的内容替换掉,用ButterKnife可以找到Toolbar
给Toolbar填上id试试