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.
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 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.
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?
Basically I want to achieve the same behaviour as that of the android status bar; when we swipe down from the top, a compact version with the frequently used buttons is shown. Upon swiping down further the status bar expands to show the expanded view.
I want to implement a toolbar in an app with the exact behaviour of the status bar as shown in the images. The first swipe on the NestedScrollView inside CollapsingToolbarLayout should expand the the toolbar to show the compact view, and the second swipe should expand the toolbar further to show the expanded view of the toolbar
How can i do that?
That is called CollapsingToolbarLayout the UX of that layout is to expand when swipe down and collapse when swipe up. The dependency of that layout is Android Support Design Library. Here is a nice tutorial for this.
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?