【发布时间】:2020-09-29 18:43:46
【问题描述】:
我有一个FloatingActionButton。我希望它是end|bottom 喜欢
这个。
目前,我的设计是这样的
我希望它位于屏幕的确切末端|底部。怎么做? 哪种布局最适合使用?
这是我的整个 xml 代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:padding="30dp">
<ImageView
android:id="@+id/post_request_back_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="@drawable/general_back_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:fontFamily="@font/muli_black"
android:text="@string/_post_request_header_name"
android:textAllCaps="true"
android:textColor="@color/colorAccent"
android:textSize="30sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="@string/how_requests_work"
android:textColor="@color/colorAccent"
android:textSize="10sp" />
<ListView
android:id="@+id/postlist"
android:layout_width="match_parent"
android:layout_height="420dp"
android:layout_marginStart="0dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="0dp"
app:layout_constraintBottom_toTopOf="@+id/postadd"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/postadd"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:src="@drawable/postrequest_add_btn" />
</LinearLayout>
【问题讨论】:
标签: android android-layout floating-action-button floating