Android 晶圆厂未锚定到一致的视图

Android 晶圆厂未锚定到一致的视图,android,android-layout,android-coordinatorlayout,floating-action-button,Android,Android Layout,Android Coordinatorlayout,Floating Action Button,我的浮动操作按钮无法正确定位到视图。看起来他们在测量视图之前就已经锚定了 当问题出现时,FAB定位在屏幕的左上角,如: 当它正常工作时: 行为是随机的,当它不能正确定位时,它有时会在没有用户交互的情况下自行修复。其他时候,它不会自行纠正 我尝试搜索的所有内容都通过添加layout_anchor或layout_anchorgravity属性得到了解决,我已经包括了这些属性 任何建议都将不胜感激 这是我的布局。 编辑:原来有错误的布局 xmlns:android=”http://schemas

我的浮动操作按钮无法正确定位到视图。看起来他们在测量视图之前就已经锚定了

当问题出现时,FAB定位在屏幕的左上角,如:

当它正常工作时:

行为是随机的,当它不能正确定位时,它有时会在没有用户交互的情况下自行修复。其他时候,它不会自行纠正

我尝试搜索的所有内容都通过添加layout_anchor或layout_anchorgravity属性得到了解决,我已经包括了这些属性

任何建议都将不胜感激

这是我的布局。 编辑:原来有错误的布局

xmlns:android=”http://schemas.android.com/apk/res/android"
xmlns:app=”http://schemas.android.com/apk/res-auto"
android:layout\u width=“匹配父项”
android:layout\u height=“match\u parent”>

尝试将浮动操作按钮锚定到俯视图(即,上面有“占位符”文本视图的按钮)

查看chris banes在github上的cheesesquare项目:
它可能会给你一些想法。

尝试将浮动操作按钮锚定到俯视图(即,上面有“占位符”文本视图的按钮)

查看chris banes在github上的cheesesquare项目:
它可能会给你一些想法。

我本来就是这样的,现在仍然有同样的行为。我将查看链接的项目,看看是否有什么突出的地方。我认为这是这个意外行为的问题跟踪程序:我本来就有这样的行为,现在仍然有同样的行为。我将查看链接的项目,看看是否有突出的内容。我认为这是此意外行为的问题跟踪程序:
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">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:weightSum="3">

        <LinearLayout
            android:id="@+id/first_container"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:background="@color/primary_dark"
            android:orientation="vertical"
            android:layout_weight="1">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="Place Holder - Stats coming soon"/>

        </LinearLayout>

        <LinearLayout
            android:id="@+id/second_container"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:layout_weight="2">

        <android.support.v7.widget.RecyclerView
            android:id="@+id/my_list"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"/>

        </LinearLayout>

    </LinearLayout>


    <android.support.design.widget.FloatingActionButton
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_compare_arrows_white_24dp"
        android:layout_margin="16dp"
        android:clickable="true"
        app:backgroundTint="@color/accent"
        app:layout_anchor="@id/second_container"
        app:layout_anchorGravity="top|right"/>

</android.support.design.widget.CoordinatorLayout>