package com.jiahaoliuliu.materialdesignsample;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.Toolbar;
import android.support.v7.widget.RecyclerView;

public class CollapsingToolbarActivity extends AppCompatActivity {

    private RecyclerView mSimpleRecyclerView;
    private RecyclerView.Adapter mAdapter;
    private RecyclerView.LayoutManager mLayoutManager;

    private String[] mRecyclerViewValues =
            new String[]{"Apple Pie", "Banana Bread", "Cupcake", "Donut", "Eclair", "Froyo",
                    "Gingerbread", "Honeycomb", "Ice Cream Sandwich", "Jelly Bean", "KitKat",
                    "Lollipop", "M preview"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_collapsing_toolbar);

        // Actionbar
        final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        // Link the views
        mSimpleRecyclerView = (RecyclerView) findViewById(R.id.simpleRecyclerView);

        // Use this setting to improve performance if you know that changes
        // in content do not change the layout size of the RecyclerView
        mSimpleRecyclerView.setHasFixedSize(true);

        // Use a linear layout manager
        mLayoutManager = new LinearLayoutManager(this);
        mSimpleRecyclerView.setLayoutManager(mLayoutManager);

        SimpleRecyclerViewAdapter mSimpleRecyclerViewAdapter = new SimpleRecyclerViewAdapter(mRecyclerViewValues);
        mSimpleRecyclerView.setAdapter(mSimpleRecyclerViewAdapter);
    }
}

@@ -258,16 +258,46 @@
 lerView;
+%0Aimport android.view.MenuItem;
 %0A%0Apublic
@@ -1809,10 +1809,316 @@
 ;%0A    %7D%0A
+%0A        @Override%0A    public boolean onOptionsItemSelected(MenuItem item) %7B%0A        switch(item.getItemId()) %7B%0A            case android.R.id.home:%0A                onBackPressed();%0A                return true;%0A            default:%0A                return super.onOptionsItemSelected(item);%0A        %7D%0A    %7D%0A%0A
 %7D%0A

Make the back button of collapsing toolbar activity functional