Thursday, 22 November 2018

How to make option menu appear on bottom of screen android

So here is what I am trying to implement; when people click on the menu on top right corner of a toolbar, a options menu appear on a bottom of a screen. This is like the picture below

enter image description here

I not sure what method should I call for the item at the bottom. Can somebody give me some a hint on how to implement this?

The icon in the top right menu bar, I implement successfully with the code below. But I don't know how to show the options in the bottom of the screen, with width match_parent, and height wrap_content

onClick on the right top corner

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.edit_profile_image_menu, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();

        switch (id) {
            case R.id.more:
                //How to show the 2 option in the bottom of screen here


                return true;
        }

        return super.onOptionsItemSelected(item);
    }

Update After implement the code of Nikesh,the popup shown like this

enter image description here



from How to make option menu appear on bottom of screen android

No comments:

Post a Comment