How to handle issues of the new bottom sheet of the support/design library?

不问归期 提交于 2019-12-02 18:31:21

UPDATE Link to the full answer in where you can find all the explanation about how to get full behaviors like Google Maps.


Helping you with what you want

what I wanted, which is the 3-phases I've done before

Using Support Library 23.x+ you can do it modifying default BottomSheetBehavior adding one more stat with following steps:

  1. Create a Java class and extend it from CoordinatorLayout.Behavior<V>
  2. Copy paste code from default BottomSheetBehavior file to your new one.
  3. Modify the method clampViewPositionVertical:

  4. Add a new state

    public static final int STATE_ANCHOR_POINT = X;

  5. Modify the next methods: onLayoutChild, onStopNestedScroll, BottomSheetBehavior<V> from(V view) and setState (optional)

So now you have those states:
STATE_HIDDEN
STATE_COLLAPSED
STATE_DRAGGING
STATE_ANCHOR_POINT
STATE_EXPANDED.

You can use setBottomSheetCallback like you do in original BottomSheetBehavior

The XML (without anything about parallax image like google maps) looks like:

<CoordinatorLayout>

    <FrameLayout/>

    <AppBarLayout>
        <CollapsingToolbarLayout>
            <Toolbar/>
        </CollapsingToolbarLayout >
    </AppBarLayout >

    <NestedScrollView>
        <LinearLayout/>
    </NestedScrollView>

</CoordinatorLayout >



I'm going to add a link to the example project where you can find what you are looking for

And here is how its looks like:
[

]

You can use this library. As far as I have seen there is no issue with this library.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!