Search code examples
androidmaterial-designandroid-5.0-lollipop

How to create movable activity?


please i want to know how i can perform a movable activity that appears from bottom and stuck in the middle of screen, like android lollipop contact details or android lollipop chooser. I want to stop activity if user move it to bottom, like this picture of Borel's detail

Borel detail picture


Solution

  • Use BottomSheetDialog in design support library. An example below.

            BottomSheetDialog mBottomSheetDialog = new BottomSheetDialog(this);
            View view = getLayoutInflater().inflate(R.layout.your_layout, null);
            mBottomSheetDialog.setContentView(view);
            mBottomSheetDialog.show();