Note that there are some explanatory texts on larger screens.

plurals
  1. POSlide a layout up from bottom of screen
    primarykey
    data
    text
    <p>I have a layout hidden from the view. On a button click I want it to slide up from the bottom pushing the entire screen contents upwards, very similar to how whatsapp shows emoticons panel in chat screen. </p> <p>I have seen SlidingDrawer, that dosen't work for me. It requires an image as an handle which is shown at the center of the screen, I don't want that. It also slides over the existing screen content, I am looking for a way to move the existing content upwards.</p> <p><strong>Update 1:</strong></p> <p>I tried using the animations as suggested by Sanket Kachhela. But the hidden layout is never shown. Here is the code.</p> <p><strong>Layout (activity_main.xml):</strong> </p> <pre><code>&lt;RelativeLayout android:id="@+id/main_screen" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:layout_alignParentTop="true"/&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" android:layout_centerInParent="true"/&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Slide up / down" android:layout_alignParentBottom="true" android:onClick="slideUpDown"/&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/hidden_panel" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/main_screen"&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/app_name" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p></p> <p><strong>Activity (MainActivity.java):</strong></p> <pre><code>package com.example.slideuplayout; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.ViewGroup; import android.view.animation.Animation; import android.view.animation.AnimationUtils; public class MainActivity extends Activity { private ViewGroup hiddenPanel; private boolean isPanelShown; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); hiddenPanel = (ViewGroup)findViewById(R.id.hidden_panel); hiddenPanel.setVisibility(View.INVISIBLE); isPanelShown = false; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void slideUpDown(final View view) { if(!isPanelShown) { // Show the panel Animation bottomUp = AnimationUtils.loadAnimation(this, R.anim.bottom_up); hiddenPanel.startAnimation(bottomUp); hiddenPanel.setVisibility(View.VISIBLE); isPanelShown = true; } else { // Hide the Panel Animation bottomDown = AnimationUtils.loadAnimation(this, R.anim.bottom_down); hiddenPanel.startAnimation(bottomDown); hiddenPanel.setVisibility(View.INVISIBLE); isPanelShown = false; } } } </code></pre> <p><strong>Animations:</strong></p> <p>bottom_up.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;translate android:fromYDelta="75%p" android:toYDelta="0%p" android:fillAfter="true" android:duration="500" /&gt; &lt;/set&gt; </code></pre> <p>bottom_down.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;translate android:fromYDelta="0%p" android:toYDelta="100%p" android:fillAfter="true" android:interpolator="@android:anim/linear_interpolator" android:duration="500" /&gt; &lt;/set&gt; </code></pre> <p>Any ideas how this can be done ?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload