I have a ScrollView
at the top, inside that I have a ConstraintLayout
. Setting height to match_parent
doesn't work in ConstraintLayout so the height doesn't match the screen. Inside my ConstraintLayout
I have a floating action button and it doesn't stay at the right bottom of the screen, but it stays at the right bottom of ConstraintLayout
.
Image of my screen
How can I make the floating action button stay at the right bottom of the screen?
If your FAB is inside constraint layout try like this
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:clickable="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/icon" />
</android.support.constraint.ConstraintLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/contactBtn"
android:layout_width="53dp"
android:layout_height="62dp"
android:clickable="true"
android:layout_gravity="bottom|right"
app:srcCompat="@android:drawable/ic_menu_send" />
This Worked For me..
android:layout_gravity="bottom|right"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With