【发布时间】:2017-01-28 17:27:49
【问题描述】:
我从 24.2.0 开始就一直有这个问题,但现在我使用的是 24.2.1 并且错误仍然存在,它只运行良好
我有一个锚定的 FloatingActionButton,如下所示:
<ScrollView
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.CoordinatorLayout
android:id="@+id/contact_coordinator_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="es.cocode.baseapp.contact.ContactFragment">
<FrameLayout
android:id="@+id/map_fragment_container"
android:layout_width="match_parent"
android:layout_height="198dp"
android:layout_marginBottom="210dp">
<fragment
android:id="@+id/map_fragment"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_fullscreen_map"
android:src="@drawable/ic_fullscreen_white_48dp"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_margin="@dimen/fab_margin"
app:layout_anchor="@id/map_fragment_container"
app:layout_anchorGravity="bottom|end" />
</android.support.design.widget.CoordinatorLayout>
</ScrollView>
它通常是这样工作的:
但有时会出现bug,锚点不起作用:
有没有办法解决这个问题,或者我应该等到这个错误得到修复并改用 24.1.1 吗?
【问题讨论】:
-
CoordinatorLayout在ScrollView内?尝试在 ScrollView 中仅包装可滚动内容(FrameLayout)。 -
所有都是“可滚动内容”(FAB 之后我有一个包含标签,其布局包含地点、电话、邮件和网站)。
-
同样的事情发生在我身上。大多数时候,晶圆厂的锚重力工作正常,但有时不能,导致您所描述的情况。哦,好吧,现在恢复...
-
@JoaoSousa 我已经发布了答案。
-
就我而言,我什至没有地图,但我知道这可能是由于布局中的测量变化而发生的。我真的不想连接听众并控制晶圆厂的知名度,但也许我在这里别无选择。
标签: android android-support-library android-design-library androiddesignsupport floating-action-button