Delphian Delphian - 3 months ago 9
Android Question

FloatingActionButton placement

I can't do the indend from the bottom. I have the indend in the design view window, but in a real device I haven't the indend.

[Design view window] Design view window

[A real device] A real device

Layout with FloatingActionButton:

<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"
android:background="@color/mainBackground">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/quantity_text"
android:textColor="@android:color/white"
android:textSize="@dimen/quantity_text_size"
android:layout_marginTop="50dp"
android:layout_centerHorizontal="true"
android:id="@+id/quantity_text"
android:layout_marginBottom="5dp"/>

<EditText
android:layout_centerHorizontal="true"
android:layout_below="@+id/quantity_text"
android:background="@drawable/quantity_style"
android:id="@+id/quantity_field"
android:hint="Количество"
android:textColorHint="@android:color/white"
android:layout_width="@dimen/quantity_field_width"
android:layout_height="@dimen/quantity_field_height"
android:inputType="phone"
android:paddingLeft="10dp"
android:textColor="@android:color/black">
<requestFocus/>
</EditText>

<android.support.design.widget.FloatingActionButton
android:id="@+id/save_floating_button"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/floating_action_btn_margin"
android:contentDescription="@string/app_name"
android:src="@drawable/ic_send_black_24dp"
android:visibility="visible"
app:elevation="2dp"
app:borderWidth="0dp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:clickable="true"
app:backgroundTint="@color/circleBackground"
app:rippleColor="@color/changeFloatingButton"
app:pressedTranslationZ="4dp"/>



Answer

I think that you could use android:layout_marginBottom="16dp"

Edit:

<RelativeLayout xmlns:android="schemas.android.com/apk/res/android"
    xmlns:app="schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/mainBackground" 
    android:paddingBottom="16dp">
Comments