Skip to content

The XML layout needed for this library

MiguelHincapieC edited this page Jan 25, 2018 · 1 revision

The XML structure you need is the following one:

<CoordinatorLayout/>
    
    <fragment android:name="com.google.android.gms.maps.SupportMapFragment"/>
    
    <AppBarLayout>  
        <Toolbar/>
    </AppBarLayout>
    
    <ViewPager/> --or a simple imageView

    <NestedScrollView>
        <include layout="@layout/bottom_sheet_content"/>
    </NestedScrollView>

    <FloatingActionButton/>

    <com.mahc.custombottomsheetbehavior.MergedAppBarLayout/>
</CoordinatorLayout>

Almost all of them use the attribute: app:layout_behavior which are listed below:

  • AppBarLayout -> app:layout_behavior="@string/ScrollingAppBarLayoutBehavior"
  • ViewPager -> app:layout_behavior="@string/BackDropBottomSheetBehavior"
  • NestedScrollView -> app:layout_behavior="@string/BottomSheetBehaviorGoogleMapsLike"
  • FloatingActionButton -> app:layout_behavior="@string/ScrollAwareFABBehavior"
  • MergedAppBarLayout -> app:layout_behavior="@string/MergedAppBarLayoutBehavior"

For more detail about XML please take a look at the example [activity_main.xml file](https://github.com/miguelhincapie/CustomBottomSheetBehavior/blob/master/app/src/main/res/layout/activity_main.xml)
Note: The example comes with a dummy FrameLayout for replacing the map one due config files needed to use google maps.
Clone this wiki locally