トラッキング コード

3/19/2016

BottomSheet vis Android Design Support Library 23.2.0

Android Design Support Library had added BottomSheet from ver.23.2.
We can implement BottomSheet design like a GoogleMap.


AOSP: BottomSheetBehavior.java

Layout Sample

We add the param app:layout_behavior="@string/bottom_sheet_behavior" in child view of CoordinatorLayout.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<android.support.design.widget.CoordinatorLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
 
    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            app:layout_behavior="@string/bottom_sheet_behavior"
            app:behavior_peekHeight="240dp"
            app:behavior_hideable="false"
            android:background="@android:color/white">
        <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:text="BottomSheet Sample"/>
    </LinearLayout>
</android.support.design.widget.CoordinatorLayout>
We cab add following params.

  • app:behavior_peekHeight
    • BottomSheet minimum size
  • app:behavior_hideable
    • BottomSheet is hidden when scroll to bottom.


No comments:

Post a Comment