hsk*_*dag 6 android floating-action-button android-constraintlayout
我ScrollView在顶部有一个,里面有一个ConstraintLayout. 将高度设置为match_parent在 ConstraintLayout 中不起作用,因此高度与屏幕不匹配。在我的内部,我ConstraintLayout有一个浮动操作按钮,它没有停留在屏幕的右下角,而是停留在ConstraintLayout.
我的屏幕图像
如何使浮动操作按钮停留在屏幕右下角?
如果您的 FAB 在约束布局内,请尝试这样
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:clickable="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/icon" />
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3863 次 |
| 最近记录: |