2016-06-01 9 views
3

を隠している:FABは、私はXMLを以下しているボトムシート下

<android.support.design.widget.CoordinatorLayout 
    android:id="@+id/sliding_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@id/app_bar"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <fragment 
      android:id="@+id/fragment1" 
      android:name="com.xyz.Fragment1" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:gravity="center" 
      tools:layout="@layout/fragment_layout1" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/layoutBottomSheet" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:elevation="@dimen/global_margin" 
     android:orientation="vertical" 
     app:layout_behavior="@string/bottom_sheet_behavior"> 

     <fragment 
      android:id="@+id/fragment2" 
      android:name="com.xyz.Fragment2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center|top" 
      tools:layout="@layout/fragment_layout2" /> 
    </LinearLayout> 

    <android.support.design.widget.FloatingActionButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginEnd="@dimen/global_margin" 
     android:layout_marginRight="@dimen/global_margin" 
     android:src="@drawable/ic_add_white_24dp" 
     app:borderWidth="0dp" 
     app:elevation="4dp" 
     app:layout_anchor="@id/layoutBottomSheet" 
     app:layout_anchorGravity="top|right|end" /> 
</android.support.design.widget.CoordinatorLayout> 

レイアウトは、そのFragment2の下Fragment1、のように表示されますとFABはそれが下Fragment2に固定しかし、Fragment2上とされていません。

は、実際に間違って起こっている

screenshot

、として表示されますか?何か案が?

答えて

2

layoutBottomSheet -LinearLayoutの標高は@dimen/global_marginです。このディメンションがFloatingActionButtonの仰角として定義した4dpより大きい場合、ボタンは高位のレイアウトの後ろに隠されます。

おそらくその寸法は4dpより大きいでしょう。それに応じて、ボタンの高さを変更します。

+0

はい、16dpでした。指摘してくれてありがとう。 – Mangesh

0

style="@style/Widget.Design.BottomSheet.Modal"を使用している場合は、下部シートの高さよりも高い値(style="@style/Widget.Design.BottomSheet.Modal"を使用している場合は16dp)のFABでsetCompatElevation(...)を呼び出すことができます。

関連する問題