title: Android, animation, How to sliding in and out a layout from screen?
body: <p>In my application I need to record by camera. During recording I show some items as menu on screen. I need to slide out menu from screen when user clicks an arrow and slide it in when user touched the screen.</p>
  
  <p>I have two problem.
  1) It seems my animation doesn't work.
  2) when i set RelativeLayout to visible/invisible just the view take effect, camera view doesn't get the whole of screen as you see in images (I don't want see black background).</p>
  
  <p><img src="https://i.stack.imgur.com/e7k7c.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/MyG7E.png" alt="enter image description here"></p>
  
  <p>R.anim.slide_in_up:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;translate 
      xmlns:android       = "http://schemas.android.com/apk/res/android"
      android:fromYDelta  = "100%p" 
      android:toYDelta    = "0%p"
      android:duration    = "3000" /&gt;
  </code></pre>
  
  <p>R.anim.slide_out_up:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;translate 
      xmlns:android       = "http://schemas.android.com/apk/res/android"
      android:fromYDelta  = "0%p" 
      android:toYDelta    = "100%p"
      android:duration    = "3000" /&gt;
  </code></pre>
  
  <p>Code, for showing slide_in_up:</p>
  
  <pre><code>rlMenu = (RelativeLayout) findViewById(R.id.rlMenu);
          imHide  = (ImageView) findViewById(R.id.btn_hide);
          imHide.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  rlMenu.setVisibility(View.INVISIBLE);
                  overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up);
              }
          });
  </code></pre>
  
  <p>Code, for showing slide_out_up:</p>
  
  <pre><code>@Override
      public boolean onTouchEvent(MotionEvent event) {
  
          rlMenu.setVisibility(View.VISIBLE);
          overridePendingTransition(R.anim.slide_out_up, R.anim.slide_in_up);
  
          return super.onTouchEvent(event);
      }
  </code></pre>
  
  <p>Screen layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout
      xmlns:android           = "http://schemas.android.com/apk/res/android"
      android:layout_width    = "fill_parent"
      android:layout_height   = "fill_parent"
      android:orientation     = "vertical" &gt;
  
  
  
       &lt;FrameLayout
          android:id              = "@+id/camera_preview"
          android:layout_width    = "fill_parent"
          android:layout_height   = "0dip"
          android:layout_weight   = "1" /&gt;
  
  
  
       &lt;RelativeLayout
           android:id             = "@+id/rlMenu"
           android:layout_width   = "fill_parent"
           android:layout_height  = "wrap_content"
           android:orientation    = "horizontal" &gt;
  
           &lt;RelativeLayout
               android:layout_width           = "240dip"
               android:layout_height          = "50dip"
               android:background             = "@drawable/btn_top_edge_right"
               android:layout_alignParentLeft = "true" &gt;
  
               &lt;ImageView 
                   android:id                     = "@+id/btn_hide"
                   android:layout_width           = "40dip"
                   android:layout_height          = "wrap_content"
                   android:src                    = "@drawable/btn_record_hide"
                   android:layout_marginTop       = "10dip"
                   android:layout_marginBottom    = "10dip"
                   android:contentDescription     = "@string/menu_contentdescription"
                   android:scaleType              = "fitXY" /&gt;
  
               &lt;ImageView 
                   android:id                     = "@+id/btn_record"
                   android:layout_width           = "wrap_content"
                   android:layout_height          = "wrap_content"
                   android:src                    = "@drawable/btn_record_start"
                   android:layout_toRightOf       = "@id/btn_hide"
                   android:layout_margin          = "10dip"
                   android:contentDescription     = "@string/menu_contentdescription" /&gt;
  
               &lt;ImageView 
                   android:id                     = "@+id/btn_stop"
                   android:layout_width           = "wrap_content"
                   android:layout_height          = "wrap_content"
                   android:src                    = "@drawable/btn_record_stop"
                   android:layout_toRightOf       = "@id/btn_record"
                   android:layout_marginTop       = "10dip"
                   android:layout_marginBottom    = "10dip"
                   android:contentDescription     = "@string/menu_contentdescription"
                   android:clickable              = "false" /&gt;         
           &lt;/RelativeLayout&gt;
  
  
           &lt;Button
               android:id                         = "@+id/btn_done"
               android:layout_width               = "wrap_content"
               android:layout_height              = "50dip"
               android:background                 = "@drawable/btn_record_done"
               android:layout_alignParentRight    = "true"
               android:text                       = "@string/Record_btn"
               android:paddingLeft                = "15dip"
               style                              = "@style/simpletopic.bold" /&gt;
  
       &lt;/RelativeLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>How can I remove the whole of RelativeLayout and enlarge camera view with my animation?
  Thanks</p>