[Solved] Drop down menu UI


use popup window for this type of options:

llBack.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {

                showPopupMenu();
            }
        });

and the showPopupMenu() method is:

public void showPopupMenu() {
        LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);

        View popupView = inflater.inflate(R.layout.add_file_lay,
                this.container, false);

        popupWindow = new PopupWindow(popupView, popupwidth,
                WindowManager.LayoutParams.WRAP_CONTENT, true);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setBackgroundDrawable(new BitmapDrawable());
        popUpwindowinIt(popupView);

        popupWindow.showAsDropDown(findViewById(R.id.places), 0, 0);

    }

here in above code R.id.places is the hidden layout in layout file where we want to show the menu, like below the menu button;

and here is the add_file_lay named view to show as popup menu:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingRight="5dp" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#262127" >

        <ImageView
            android:id="@+id/downarrow_afile"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:layout_marginRight="1dp" />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:orientation="vertical" >

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal" >

                <RelativeLayout
                    android:id="@+id/gallerylay"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1" >

                    <ImageView
                        android:id="@+id/gallerybtn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:src="https://stackoverflow.com/questions/28873575/@drawable/gal" />

                    <TextView
                        android:id="@+id/gallerytxt"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/gallerybtn"
                        android:layout_centerHorizontal="true"
                        android:singleLine="true"
                        android:text="Gallery"
                        android:textColor="#ffffff"
                        android:textSize="12sp" />
                </RelativeLayout>

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="#ffffff" />

                <RelativeLayout
                    android:id="@+id/photolay"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1" >

                    <ImageView
                        android:id="@+id/photobtn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:src="@drawable/cam" />

                    <TextView
                        android:id="@+id/phototxt"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/photobtn"
                        android:layout_centerHorizontal="true"
                        android:singleLine="true"
                        android:text="Take Photo"
                        android:textColor="#ffffff"
                        android:textSize="12sp" />
                </RelativeLayout>

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="#ffffff" />

                <RelativeLayout
                    android:id="@+id/videolay"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1" >

                    <ImageView
                        android:id="@+id/videobtn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:src="@drawable/video" />

                    <TextView
                        android:id="@+id/videotxt"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/videobtn"
                        android:layout_centerHorizontal="true"
                        android:singleLine="true"
                        android:text="Video"
                        android:textColor="#ffffff"
                        android:textSize="12sp" />
                </RelativeLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="#ffffff" />

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="#ffffff" />

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="#ffffff" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal" >

                <RelativeLayout
                    android:id="@+id/audiolay"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1" >

                    <ImageView
                        android:id="@+id/audiobtn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:src="@drawable/ausio" />

                    <TextView
                        android:id="@+id/audiotxt"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/audiobtn"
                        android:layout_centerHorizontal="true"
                        android:layout_marginTop="1dp"
                        android:singleLine="true"
                        android:text="Audio"
                        android:textColor="#ffffff"
                        android:textSize="12sp" />
                </RelativeLayout>

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="#ffffff" />

                <RelativeLayout
                    android:id="@+id/locationlay"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="5dp"
                    android:layout_marginTop="5dp"
                    android:layout_weight="1" >

                    <ImageView
                        android:id="@+id/locationbtn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:src="@drawable/location" />

                    <TextView
                        android:id="@+id/locationtxt"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/locationbtn"
                        android:layout_centerHorizontal="true"
                        android:layout_marginTop="1dp"
                        android:singleLine="true"
                        android:text="Location"
                        android:textColor="#ffffff"
                        android:textSize="12sp" />
                </RelativeLayout>

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="#ffffff" />

                <RelativeLayout
                    android:id="@+id/relativeLayoutAddContact"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:visibility="visible" >

                    <ImageView
                        android:id="@+id/contactbtn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:clickable="false"
                        android:layout_centerHorizontal="true"
                        android:src="@drawable/contact" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:clickable="false"
                        android:layout_below="@id/contactbtn"
                        android:layout_centerHorizontal="true"
                        android:text="Contact"
                        android:textColor="#ffffff"
                        android:textSize="12sp" />
                </RelativeLayout>
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>

</RelativeLayout>

2

solved Drop down menu UI