我不能從底部做縮進。我在設計視圖窗口中有縮進,但是在真實設備中,我沒有縮進。FloatingActionButton放置
設計視圖窗口
真實設備與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"/>
是否使用'CoordinatorLayout'與FAB? –
不,我使用RelativeLayout就像上面的例子,沒有別的 – Delphian
你應該使用浮動動作按鈕的座標佈局 –