2017-02-08 2 views

答えて

1

...私は、検索をしましたが、私は何も見つかりませんでした:

I - bottomsheet.XML

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="300dp" 
    android:orientation="vertical" 
    android:padding="16dp" 
    app:layout_behavior="@string/bottom_sheet_behavior"> 

    <!-- add your content here --> 
</LinearLayout> 

を作ります今あなたの主な活動では、それは直接の子供である方法でそれを実装します。CoordinatorLayout

<include layout="@layout/bottomsheet" /> 
JAVAコードの場合

III-次のコマンドを使用します。

inearLayout bottomSheetViewgroup = (LinearLayout) findViewById(R.id.bottom_sheet); 

BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheetViewgroup); 

あなたのボトムシート(隠れ、拡大、ドラッグ、崩壊)を制御するには:

bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); 

PS-あなたはこれを次のように処理できます。

STATE_EXPANDED:下のシートを完全に展開します。

STATE_HIDE:下のシートを完全に非表示にする。

STATE_COLLAPSED:peekHeight属性に設定された値を使用して下端シート高さを設定します。

関連する問題