title: How to make linear layout disappear when a user swipe up the screen in CoordinatorLayout
body: <p>I will like to make the upper layout of my app to disappear when a user swipe up the screen, but when she swipe down the layout should appear again. So here is my...</p>
  
  <blockquote>
    <p>Layout_file.xml</p>
  </blockquote>
  
  <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:layout_width="match_parent"
      android:animateLayoutChanges="true"
      android:layout_height="match_parent"&gt;
  
      &lt;LinearLayout android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/mLayout"
                    android:orientation="vertical"&gt;
  
              &lt;LinearLayout
              android:id="@+id/anim"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:padding="20dp"
              android:background="@android:color/holo_purple"
              android:orientation="vertical"&gt;
  
              &lt;TextView
                  android:padding="5dp"
                  android:paddingBottom="5dp"
                  android:paddingTop="5dp"
                  android:textColor="#fff"
                  android:textAllCaps="true"
                  android:textAppearance="?android:textAppearanceMedium"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="@string/today_quo"/&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:id="@+id/viewB"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_weight="0.4"
              android:background="#fff"
              android:orientation="vertical"&gt;
  
  Some xml codes
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  
      &lt;android.support.design.widget.FloatingActionButton
          android:id="@+id/fab"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_margin="16dp"
          android:clickable="true"
          app:backgroundTint="#FF04A8"
          android:src="@drawable/share"
          app:layout_anchor="@id/viewA"
          app:layout_anchorGravity="bottom|right|end"/&gt;
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>
  
  <p>and my java file is shown below...</p>
  
  <blockquote>
    <p>MyJavaFile.class</p>
  </blockquote>
  
  <pre><code>//Add animation to the layout
       ll = (LinearLayout)rootView.findViewById(R.id.anim);
      ll.setVisibility(View.VISIBLE);
      ll.setAlpha(0.0f);
      ll.animate().translationY(ll.getHeight()).alpha(1.0f).setListener(new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
              super.onAnimationEnd(animation);
  
              //OntouchListener that make the upper layout to disappear
              ll.setOnTouchListener(new View.OnTouchListener() {
                  @Override
                  public boolean onTouch(View v, MotionEvent event) {
                      if (ll.getX() == 1.0) {
                          ll.setVisibility(View.GONE);
                          fab.hide();
                      }
                      else if(ll.getX() == 0.0) {
                          ll.setVisibility(View.VISIBLE);
                          fab.show();
                      }
                      return true;
                  }
              });
          }
      });
  </code></pre>