【发布时间】:2021-11-14 06:17:41
【问题描述】:
我在将 FAB 定位在 Fragment 中时遇到问题。 FAB 在左上角,但我需要它在右下角。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.vrhcaby.VrhcabyFragment">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAlignment="center"
android:src="@mipmap/dice_180"
android:layout_margin="100px" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</RelativeLayout>
我有什么问题?
【问题讨论】:
-
您想在Activity或Fragment中的哪个位置添加FloatingActionButton?
标签: java android android-layout android-fragments