小编JYL*_*JYL的帖子

CoordinatorLayout 中 prev 布局覆盖的 FloatingActionButton

这是我的 xml 代码。

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
    android:layout_height="300dp"  
    android:background="#0000FF"
    android:id="@+id/dialog_frame"
    android:orientation="vertical"
    android:elevation="24dp">


</LinearLayout>


<android.support.design.widget.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_anchor="@id/dialog_frame"
    android:id="@+id/login_close"
    app:layout_anchorGravity="bottom|center_horizontal"
    android:clickable="true"/>

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

我希望 FAB 浮动在线性布局上,但线性布局覆盖了 FAB。

我的 xml 代码布局截图:

在此处输入图片说明

我不知道为什么会这样。有什么不对吗,我想?

android floating-action-button android-coordinatorlayout

1
推荐指数
1
解决办法
668
查看次数