I have created a custom progress bar and I have added it to the window decorview's root view. However, when a bottom sheet is visible, this progress bar is drawn behind the bottom sheet rather than drawing on top of it. Shouldn't it be drawn on top of the bottom sheet?
val loader = FullScreenLoader(
requireContext(),
containerView = requireActivity().window.decorView.rootView as ViewGroup
)
loader.show()
Shouldn't it be drawn on top of the bottom sheet?
It behaves as expected as the progress bar is attached to the activity's window, not to the bottom sheet window.
Bottom sheets behave like dialogs (actually there are versions of them that extend Dialogs like BottomSheetDialog & BottomSheetDialogFragment. Like dialogs, if we tap outside the Bottom Sheet, it is dismissed just. there are also slide up and slide down to activate and deactivate the Bottom Sheet respectively.
If you want that progress bar overlay on top of the BottomSheet, you need to attach it to the BottomSheet dialog window instead of the activity's window.
Related
I'm trying to add a fixed button at the bottom of compose bottomsheet. The button should be visible at all times in collapsed state and should stay static at the bottom as the user slides up through the sheet.
Sample behavior: https://medium.com/#KaneCheshire/sticky-ui-in-android-bottom-sheet-3d65ea1d20dc
I have tried using a subcompose layout and placed the button by subtracting button height from visible sheet height like so;
constraints.maxHeight - sheetState.offset.value - ctaPlaceable.height
but with this I cant achieve the desired transition when the sheet is sliding down from collapsed to dismissed as the button remain fixed at their position. I want the buttons to slide down when the sheet is being dismissed and remain fixed in their position when the sheet is sliding up.
Can anyone help?
I have a fragment, within that fragment I want to display a standard bottom sheet. When the sheet is expanded Id like to display a toolbar at the top of the sheet, with close/collapse button, something like presented on https://material.io/components/sheets-bottom#behavior under Behaviour -> Visibility -> FullScreen
To my surprise Im struggling to achieve similar effect - tried applying different scroll flags (app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed") however Im getting opposite results - toolbar is visible when sheet is half extended and disappars when I scroll the sheet to the top.
I would like to achieve Bottom Sheet dialog behavior like in Google Maps transport route itinerary: if you click on expandable item the top of the sheet is not moving but the sheet grows below the screen bottom bounds. The text on top of the sheet is fixed but the dialog itself increases in height.
How to achieve this behavior with BottomSheetDialogFragment?
I need to implement this UI.
This is layout with a closed Bottom Sheet.
This is layout with an open Bottom Sheet.
I implemented Bottom Sheet as in the design, but my problem is that the Bottom Sheet climbs over the Recycler View. I want to implement this like in design - when I open the Bottom Sheet, my Recycler View will decreased dynamically in size. Please tell me how to set this behavior for Bottom Sheet. How can I get distance between Toolbar and top part of Bottom Sheet and how I can reduce Recycler View size with animation when Bottom Sheet was opened?
This is my code,
View bottomSheet = findViewById( R.id.bottom_sheet );
mBottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
mBottomSheetBehavior.setPeekHeight(100);
mBottomSheetBehavior.setPeekHeight(100);
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
Is it possible to add overlay to background for Persistent Bottom sheet, when the Persistent bottom sheet is expanded?
If you want overlay bottom sheet, you can use bottom sheet dialog instead. With persistent bottom sheet, user can continue to work with main section of the screen. Where as with bottom sheet dialog, user can't work on the main section of the screen while dialog is on.