coffeeak
coffeeak

Reputation: 3120

Menu that appears from the bottom on button click Android

I am learning Android these days, and I am having some trouble implementing something. When I click on the image icon, I want a menu to appear from below. The screenshot is as below. (Sorry it's in chinese....)

enter image description here

Upvotes: 0

Views: 681

Answers (3)

young_08
young_08

Reputation: 1216

You can simply follow the below link , it will implement what u need : http://trickyandroid.com/fragments-translate-animation/

This will be done through Transition Fragment Animation .

Upvotes: 0

Ankush Sharma
Ankush Sharma

Reputation: 933

I think what you are trying to do here is to replicate the action sheet of iOS in android. There is this library which does exactly what you are looking for, https://github.com/baoyongzhang/android-ActionSheet . You can either have it as it as it is provided by author or you can clone it and suit your need accordingly. I would prefer if you could clone it as a module in your app that way you have limitless way to re-design it. If you need help on that let us know

Upvotes: 0

Jay Savsani
Jay Savsani

Reputation: 329

There's awesome library on github to get your task done.

All you need to do is setup your layout in two part as describe in below code part 1: Your main activity(main frame)

part 2: bottom Panel which will be shown when user swipe/click on button. You must check how to set "anchor point true" in library document.

    <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto"
    android:id="@+id/bottom_panel"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    sothree:umanoDragView="@+id/dragView"
    sothree:umanoPanelHeight="68dp"
    sothree:umanoParalaxOffset="10dp">


    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </FrameLayout>


    <RelativeLayout
        android:id="@+id/panel"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <!--This is bottom layout.-->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#00FF00"
            android:orientation="vertical">

            <Button
                android:layout_width="match_parent"
                android:layout_height="100dp"
                android:background="#0000FF"
                android:text="Button 1" />
            <Button
                android:layout_width="match_parent"
                android:layout_height="100dp"
                android:background="#0000FF"
                android:text="Button 1" />
            <Button
                android:layout_width="match_parent"
                android:layout_height="100dp"
                android:background="#0000FF"
                android:text="Button 1" />
        </LinearLayout>

    </RelativeLayout>
</com.sothree.slidinguppanel.SlidingUpPanelLayout>

Upvotes: 1

Related Questions