content: package com.aishang5wpj.juheDemo.juhe02;
  
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.design.widget.CollapsingToolbarLayout;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.DefaultItemAnimator;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.support.v7.widget.Toolbar;
  import android.view.View;
  
  import com.aishang5wpj.juheDemo.R;
  
  /**
   * Created by wpj on 16/5/30上午11:19.
   */
  public class CollapsingToolbarLayoutActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(@Nullable Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_collapsing_toolbar);
  
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          toolbar.setNavigationOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  onBackPressed();
              }
          });
  
          CollapsingToolbarLayout layout = (CollapsingToolbarLayout) findViewById(R.id.collapsingToolBarLayout);
          layout.setTitle("collapsingToolBarLayout");
  
          RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
          recyclerView.setLayoutManager(new LinearLayoutManager(this));
          recyclerView.setAdapter(new AppBarLayoutActivity.MyAdapter());
          recyclerView.setItemAnimator(new DefaultItemAnimator());
          recyclerView.setHasFixedSize(true);
      }
  }
  