<android.support.v7.widget.Toolbar 
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:id="@id/toolbar"
android:background="?colorPrimary"
android:layout_width="fill_parent"
android:layout_height="?actionBarSize"
android:minHeight="?actionBarSize"
app:popupTheme="?actionBarPopupTheme"
app:navigationIcon="?homeAsUpIndicator"
xmlns:app="http://schemas.android.com/apk/res-auto" />

设置工具栏,返回操作

    private void setToolbar() {
View locView = findViewById(R.id.toolbar);
setSupportActionBar((Toolbar) locView);
((Toolbar) locView).setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SettingsActivity.this.onBackPressed();
}
});
}