我从 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>
它通常是这样工作的:
但有时会出现错误并且锚点不起作用:
有没有办法解决这个问题,或者我应该等到这个错误得到修复并使用 24.1.1 来代替?
截至2017年5月2日(25.3.1),该错误仍未修复。在尝试了所有解决方案后,唯一对我有用的解决方案是:
yourView.post(new Runnable() {
@Override
public void run() {
yourView.requestLayout();
}
});
Where yourView
是锚定视图。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)