title: Android bottom sheet does not collapse
body: <p>I'm trying to create a simple Bottom Sheet layout, One button shows and other collapse, but its not working. I was following <a href="https://code.tutsplus.com/articles/how-to-use-bottom-sheets-with-the-design-support-library--cms-26031" rel="nofollow noreferrer">this</a> tutorial but still nothing.So I'm trying to pass the state inside of buttons and then pass into the callback method to hide or expand, and the bottom sheet can't be scrolled down!</p>
  
  <p>This is the layout.</p>
  
  <pre><code>&lt;android.support.design.widget.CoordinatorLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/activity_botton_test"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fitsSystemWindows="true"&gt;
  
  &lt;ScrollView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_behavior="@string/appbar_scrolling_view_behavior"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"
          android:paddingTop="24dp"&gt;
  
          &lt;Button
              android:id="@+id/button_1"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:text="Button 1"
              android:padding="16dp"
              android:layout_margin="8dp"
              android:textColor="@android:color/white"
              android:background="@android:color/holo_green_dark"/&gt;
  
          &lt;Button
              android:id="@+id/button_2"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:padding="16dp"
              android:layout_margin="8dp"
              android:text="Button 2"
              android:textColor="@android:color/white"
              android:background="@android:color/holo_blue_light"/&gt;
  
          &lt;Button
              android:id="@+id/button_3"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:padding="16dp"
              android:layout_margin="8dp"
              android:text="Button 3"
              android:textColor="@android:color/white"
              android:background="@android:color/holo_red_dark"/&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/ScrollView&gt;
  
  &lt;android.support.v4.widget.NestedScrollView
      android:id="@+id/bottom_sheet"
      android:layout_width="match_parent"
      android:layout_height="350dp"
      android:clipToPadding="true"
      android:background="@android:color/holo_orange_light"
      app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
      &gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:text="opaa"
          android:padding="16dp"
          android:textSize="16sp"/&gt;
  
  &lt;/android.support.v4.widget.NestedScrollView&gt;
  </code></pre>
  
  <p></p>
  
  <p>Activity :</p>
  
  <pre><code>private View bottomSheet;
  private Button button1,button2,button3;
  private BottomSheetBehavior mBottomSheetBehavior;
  
  bottomSheet = findViewById( R.id.bottom_sheet );
      button1 = (Button)findViewById(R.id.button_1);
      button2 = (Button)findViewById(R.id.button_2);
      button3 = (Button)findViewById(R.id.button_3);
  
      mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
      mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
  
      mBottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
          @Override
          public void onStateChanged(View bottomSheet, int newState) {
              if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
                  mBottomSheetBehavior.setPeekHeight(0);
              }
              if(newState == BottomSheetBehavior.STATE_EXPANDED){
                  mBottomSheetBehavior.setPeekHeight(500);
              }
          }
  
          @Override
          public void onSlide(View bottomSheet, float slideOffset) {
          }
      });
       button1.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
          }
      });
      button2.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
          }
      });
  </code></pre>