2016-08-12 2 views
0

Я не могу сделать отступ снизу. У меня есть отступ в окне просмотра дизайна, но в реальном устройстве у меня нет отступа.Размещение FloatingActionButton

вид Дизайн окна

enter image description here

Реальное устройство

enter image description here

Компоновка с 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"/> 

+0

Вы используете 'CoordinatorLayout' с ФАБ? –

+0

Нет, я использую RelativeLayout, как пример выше, ничего больше – Delphian

+0

Вы должны использовать макет координат с кнопками плавающего действия –

ответ

1

Я думаю, что вы могли бы использовать 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"> 
+0

Я использовал его, но это не решило проблему – Delphian

+0

Попробуйте это ...

+0

Спасибо. Это работает! – Delphian

Смежные вопросы