How to collapse existing content when a bottomsheet is expanded? - android

I have a layout that contains a CoordinatorLayout with a ScrollView and a BottomSheet. When I set the state of the BottomSheet to expanded the BottomSheet overlaps the content of the ScrollView. I would like the height of the ScrollView to be reduced by the height of the BottomSheet. How can I achieve this?
I am going to move to using a BottomSheetDialog for now.
Thank you!

I attempted to make a solution that adjusted the layout when the bottome sheet was expanded, but ended up settling on using a BottomSheetDialog:
https://developer.android.com/reference/android/support/design/widget/BottomSheetDialog.html

Related

ScrollView: How to detect if certain View inside ScrollView is past scrolling?

I have ScrollView and inside this ScrollView are some independent Views. What I want to achieve is if View A touches top of ScrollView, it will start animating - transforming instead of hiding out of ScrollView (visible screen).
It should have "collapse" effect but not completely collapsed. This View A is not toolbar or action bar so I cant use CollapsingToolbarLayout
I want to achieve "paralax" effect on custom View instead of ToolBar. With certain child views inside this View should animate/shuffle/hide as I scroll. I cant find any native solution to this only default Toolbar.

BottomSheet click fires through

I have a BottomSheet with some non-clickable content. This BottomSheet is sliding over a RecyclerView.
Problem is when I tap on the BottomSheet, the RecyclerView item behind it fires (which of course shouldn't happen). The list also scrolls when scrolling on the BottomSheet.
I've tried to set android:clickable=false on the container of the BottomSheet with no effect.
Is there an obvious trick for preventing that?
You need to set android:clickable=true on the container of the BottomSheet instead of android:clickable=false.

Several neighboring NestedScrollView in the bottom sheet

I have two NestedScrollView with a visibility switch in the BottomSheet. The problem is that BottomSheet scrolling works only for the first NestedScrollView in the sources.
I solved the problem now, divided one BottomSheet into two. And programmatically change FABs app:layout_anchor.

Scroll range of CoordinatorLayout

I am trying to figure out how to have CoordinatorLayout scrolling range to be not screen height. My layout structure is following:
CoordinatorLayout
-- AppBarLayout
---- CollapsingToolbarLayout (scrollflags: scroll)
------ Toolbar (CollapseMode: parallax)
----- /CollapsingToolbarLayout
-- /AppBarLayout
-- NestedScrollView (Behaviour: appbar_scrolling_view_behavior)
-- /NestedScrollView
/ CoordinatorLayout
Even when NestedScrollView child height is like 100dp it can be scrolled all the way top when the content should not be scrollable at all.
Is there a way to affect the scroll range of CoordinatorLayout that if the child content is scrollable it will scroll and only the range that the height is.
I am also seeing this issue when child is RecyclerView and it has e.g. 1 50dp height child -> it should not scroll at all in this case, but when child count gets bigger it should then scroll.
Thanks.
Using AppBarLayout.ScrollingViewBehavior from below link fixes the issue with NestedScrollView
https://github.com/natario1/ConstrainedScrollBehavior/blob/master/ConstrainedScrollBehavior.java
I think as long as there's a scroll behavior in the layout and collapsingtoolbar has a scroll flag, it always can be scroll.
but you can try this trick to disable the scroll
How to disable CollapsingToolbar's collapse when scroll has not content?

CoordinatorLayout custom behavior at right of Toolbar with AppBarLayout

Based on this tutorial, https://github.com/saulmm/CoordinatorBehaviorExample,I am trying to create an application which have a circle image that scrolls up to the Right of Toolbar and when scrolling down goes to the middle of the expanded AppBarLayout.
How to make it move to right of Toolbar with above mentiond behaviour and animation.
AppBarTranslateScaleBehavior will help you achieve such a behavior.

Categories

Resources