Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 188.8.131.52 release ready!
Owner and Founder. Opencart
BottomSheetDialogFragment is a version of DialogFragment which is shown from the bottom instead of a floating dialog. Google introduced this in its Android version 23. It is used to show the additional content of the page and they have a nicer-looking entrance animation and since they are pinned to the bottom they may feel easier to use on larger devices. For detailed documentation, You can follow the official doc.
Bottom Sheets have various states like STATE_COLLAPSED, STATE_EXPANDED, STATE_DRAGGING, STATE_SETTLING, and STATE_HIDDEN. Initially, the bottom sheet can cover a defined height of the screen and the user can drag is upwards to show it on full screen or the user can drag it downwards to dismiss it. When it is covering a definite height then it is in STATE_COLLAPSED state, when it is covering the full screen then it is in STATE_EXPANDED, and when it not shown on the screen then it is in STATE_HIDDEN. So, In case of STATE_COLLAPSED, the height for which the bottom sheet is showed is called the peek height which can be assigned as the below-given codes.
Here is an image of the bottom sheet peeking.
Recently, We got into a situation where we wanted to show a full-screen bottom layout directly (without the STATE_COLLAPSED). You can achieve this by programmatically setting two values.
but this will not be a smooth transition. You will be able to clearly notice a state change. To open the bottom sheet to full screen without a noticeable animation change, you need to add an onShowListener on the onCreate function of the BottomSheetDialogFragment which will be called as soon as the bottom sheet appears and set the peek height to device’s height.
Hope this has helped you in getting the idea of what exactly happening.
That’s all for this blog. Thank you very much. This is Vedesh Kumar signing off.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.