title: Bottom Sheet Swipe Down Behavior
body: <p>I have successfully created a <code>ListView</code> within a <code>Fragment</code>. From the list I have also managed to successfully load a bottom sheet. </p>
  
  <ol>
  <li><p>If I tap the first item on the list "One" the bottom sheet appears.</p></li>
  <li><p>If I tap outside the bottom sheet, the bottom sheet disappears.</p></li>
  <li><p>If I tap the second item on the list "Two" the bottom sheet again appears.</p></li>
  <li><p>If I do as 1) again and then swipe down the bottom sheet and try to do 3), the screen stays grayed out as if the bottom sheet is still shown but not visible ... ???</p></li>
  </ol>
  
  <p>How do I correct this?</p>
  
  <p>Below is my code.</p>
  
  <p><code>SecondFragment.java</code>:</p>
  
  <pre><code>/**
   * A simple {@link Fragment} subclass.
   */
  public class SecondFragment extends Fragment {
      public SecondFragment() {
          // Required empty public constructor
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.fragment_second, container, false);
  
          String[] faList = { 
                  "One",
                  "Two",
          };
  
          ListView listView = (ListView) view.findViewById(R.id.listFa);
  
          ArrayAdapter&lt;String&gt; listviewAdapter = new ArrayAdapter&lt;String&gt;(
                  getActivity(),
                  android.R.layout.simple_list_item_1,
                  faList
          );
  
          listView.setAdapter(listviewAdapter);
  
          // Inflate the layout for this fragment
          // return view;
  
  
          final BottomSheetDialog bottomsheet = new BottomSheetDialog(this.getContext());
          View bottomSheetView = inflater.inflate(R.layout.bottom_sheet, null);
          bottomsheet.setContentView(bottomSheetView);
  
          listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
  
                  bottomsheet.show();
              }
          });
          return view;
      }
  }
  </code></pre>
  
  <p><code>fragment_second.xml</code>:</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.ifavaz.talker.SecondFragment"&gt;
  
      &lt;!-- TODO: Update blank fragment layout --&gt;
      &lt;ListView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/listFa" /&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p><code>bottom_sheet.xml</code>:</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:gravity="right"
      app:layout_behavior="android.support.design.widget.BottomSheetBehavior"&gt;
  
      &lt;ScrollView
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              android:padding="30dp"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="horizontal"
                  android:layout_marginTop="30dp"&gt;
  
                  &lt;FrameLayout
                      android:layout_width="280dp"
                      android:layout_height="wrap_content"&gt;
  
                      &lt;TextView
                          android:id="@+id/textView2"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="text is my text is my text text is my text is my text text is my text is my text text is my text is my text "
                          android:textSize="18sp"
                          android:textAlignment="textStart"
                          android:paddingRight="30dp" /&gt;
                  &lt;/FrameLayout&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
  
                  android:orientation="horizontal"
                  android:layout_marginTop="30dp"&gt;
  
                  &lt;FrameLayout
                      android:layout_width="280dp"
                      android:layout_height="wrap_content"&gt;
  
                      &lt;TextView
                          android:id="@+id/textView3"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="text is my text is my text text is my text is my text text is my text is my text text is my text is my text "
                          android:textSize="18sp"
                          android:paddingRight="30dp" /&gt;
                  &lt;/FrameLayout&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="horizontal"
                  android:layout_marginTop="30dp"&gt;
  
                  &lt;FrameLayout
                      android:layout_width="280dp"
                      android:layout_height="wrap_content"&gt;
  
                      &lt;TextView
                          android:id="@+id/textView2"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="text is my text is my text text is my text is my text text is my text is my text text is my text is my text "
                          android:textSize="18sp"
                          android:textAlignment="textStart"
                          android:paddingRight="30dp" /&gt;
                  &lt;/FrameLayout&gt;
  
              &lt;/LinearLayout&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="horizontal"
                  android:layout_marginTop="30dp"&gt;
  
                  &lt;FrameLayout
                      android:layout_width="280dp"
                      android:layout_height="wrap_content"&gt;
  
                      &lt;TextView
                          android:id="@+id/textView2"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:text="text is my text is my text text is my text is my text text is my text is my text text is my text is my text "
                          android:textSize="18sp"
                          android:textAlignment="textStart"
                          android:paddingRight="30dp" /&gt;
                  &lt;/FrameLayout&gt;
              &lt;/LinearLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  &lt;/FrameLayout&gt;
  </code></pre>