Direct and lower restriction on FloatingActionButton makes it invisible

I have FloatingActionButtoninside a ConstraintLayout, for example:

<android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <android.support.design.widget.FloatingActionButton
                android:id="@+id/fab_add_topic"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:srcCompat="@drawable/ic_add"
                app:layout_constraintRight_toLeftOf="parent"
                app:layout_constraintBottom_toTopOf="parent"
                android:foregroundGravity="right|bottom"
                android:layout_marginRight="@dimen/material_tooltip_margin_top"
                android:layout_marginBottom="@dimen/material_tooltip_margin_top"
                android:elevation="6dp"
                app:pressedTranslationZ="12dp"
                app:borderWidth="0dp"/>

</android.support.constraint.ConstraintLayout>

However, since I am inflating the layout on Fragmentwith Android data binding (in the Kotlin class), it does not appear.

I tried to implement the solutions mentioned here that are still inside the button ConstraintLayout: Bottom Align Floating Action

It looks just fine if I show it with the restrictions Top and Left.

What did I miss? Thank!

+4
source share
1 answer

Your layout includes the following two restrictions:

app:layout_constraintRight_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="parent"

FAB . , FAB .

, , FAB , FAB - . :

app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
+6

Source: https://habr.com/ru/post/1690994/


All Articles