I want to align to bottom right my FAB.
android:gravity="bottom|right"
android:layout_alignParentBottom="true
" FAB
disappearsandroid:layout_alignBottom="@id/lista_tiendas"
FAB
disappearsIt doesn't seem complicated but I just can't accomplish it
Any Ideas?
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:id="@+id/lista_tiendas" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="5dp" android:divider="@android:color/transparent" android:dividerHeight="4.0sp"/> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_add_white_48dp" app:backgroundTint="@color/spg_rosa" app:borderWidth="0dp" app:elevation="8dp" app:fabSize="normal" android:layout_alignParentRight="true" android:layout_alignParentBottom="@id/lista_tiendas" /> </RelativeLayout>
Center Align FloatingActionButton in Flutter If you are using Scaffold, you may set floatingActionButtonLocation property to FloatingActionButtonLocation. centerFloat to center make the FloatingActionButton float in the center of the screen at bottom.
Add the floating action button to your layoutThe size of the FAB, using the app:fabSize attribute or the setSize() method. The ripple color of the FAB, using the app:rippleColor attribute or the setRippleColor() method. The FAB icon, using the android:src attribute or the setImageDrawable() method.
Floating Action Button (FAB) is a very common UI control for Android apps. Shaped like a circled icon floating above the UI, it's a tool that allows users to call out the key parts of your app. FAB is quite simple and easy to implement UI element, despite that designers often incorrectly incorporate it into layouts.
For RelativeLayout
:
<com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/fab" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" ... />
For CoordinatorLayout
, you should use android:layout_gravity="end|bottom"
For ConstraintLayout
:
<com.google.android.material.floatingactionbutton.FloatingActionButton android:id="@+id/fab" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" ... />
See this answer for more information.
Layout should be RelativeLayout. Try the next code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/ly_list_form" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <ListView android:id="@+id/list_forms" android:layout_width="fill_parent" android:layout_height="wrap_content" android:dividerHeight="1dp" /> </LinearLayout> <LinearLayout android:id="@+id/ly_bar_bottom" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:gravity="right" android:orientation="horizontal"> <android.support.design.widget.FloatingActionButton android:id="@+id/button_addc" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="28dp" android:src="@drawable/ic_add" app:borderWidth="0dp" app:elevation="6dp" app:pressedTranslationZ="12dp" /> </LinearLayout>
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