0

I need to create a menu like the Notification bar, at the bottom of my application. Which means, you can drag the notification bar right? That is what I need as well.

For an example, before dragging, the menu should stay at the bottom like below

enter image description here

After the dragging, it should be like this

enter image description here

Up to now, all the Menus I have dealt with had something to with the Menu button, but this one doesn't. How can I create like this?

halfer
  • 19,824
  • 17
  • 99
  • 186
PeakGen
  • 21,894
  • 86
  • 261
  • 463
  • Being honest, I have no clue what you are talking about. The images also do not provide an insight. Do you want to create some kind of sidebar? – AntonSack Nov 04 '13 at 09:09
  • @AntonSack: These kind of menus are all over the non smart phones. OK, lets say it is a side bar. In faceBook app, you can drag right to open a menu right? I need the same to be done, but the bar should come from the bottom. Apart from that, a small part of the bar, should be always visible at the bottom so user knows there is a menu – PeakGen Nov 04 '13 at 09:13

3 Answers3

1

use Sliding Drawer to achieve this

http://developer.android.com/reference/android/widget/SlidingDrawer.html

SlidingDrawerActivity.java

public class SlidingDrawerActivity extends Activity implements OnClickListener {
 Button slideButton, b1, b2, b3;
 SlidingDrawer slidingDrawer;

 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_sliding_drawer);
  slideButton = (Button) findViewById(R.id.slideButton);
  slidingDrawer = (SlidingDrawer) findViewById(R.id.SlidingDrawer);
  b1 = (Button) findViewById(R.id.Button01);
  b2 = (Button) findViewById(R.id.Button02);
  b3 = (Button) findViewById(R.id.Button03);
  b1.setOnClickListener(this);
  b2.setOnClickListener(this);
  b3.setOnClickListener(this);
  slidingDrawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
   @Override
   public void onDrawerOpened() {
    slideButton.setText("V");
   }
  });
  slidingDrawer.setOnDrawerCloseListener(new OnDrawerCloseListener() {
   @Override
   public void onDrawerClosed() {
    slideButton.setText("^");
   }
  });
 }

 @Override
 public void onClick(View v) {
  Button b = (Button) v;
  Toast.makeText(SlidingDrawerActivity.this,
    b.getText() + " is Clicked :)", Toast.LENGTH_SHORT).show();
 }
}

activity_sliding_drawer.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="Drag the control at the bottom"
        android:textSize="20dp"
        tools:context=".SlidingDrawerActivity" />

    <SlidingDrawer
        android:id="@+id/SlidingDrawer"
        android:layout_width="wrap_content"
        android:layout_height="250dip"
        android:layout_alignParentBottom="true"
        android:content="@+id/contentLayout"
        android:handle="@+id/slideButton"
        android:orientation="vertical"
        android:padding="10dip" >

        <Button
            android:id="@+id/slideButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="^" >
        </Button>

        <LinearLayout
            android:id="@+id/contentLayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="10dip" >

            <Button
                android:id="@+id/Button01"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                android:text="Button 1" >
            </Button>

            <Button
                android:id="@+id/Button02"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                android:text="Button 2" >
            </Button>

            <Button
                android:id="@+id/Button03"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                android:text="Button 3" >
            </Button>
        </LinearLayout>
    </SlidingDrawer>

</RelativeLayout>
Dinesh Raj
  • 664
  • 12
  • 30
0

You need this library in your project. Its Android Sliding Up Panel by Umano.

Dragan
  • 328
  • 2
  • 12
0

Here is what you want, just do some change to positioning

Sliding Layer

AITAALI_ABDERRAHMANE
  • 2,499
  • 1
  • 26
  • 31
  • Be carefull. Sliding Drawer is deprecated http://developer.android.com/reference/android/widget/SlidingDrawer.html you have to refer to 'Navigation Drawer' which is what Android advise. – HpTerm Nov 04 '13 at 09:46