I have been having this issue since 24.2.0, but now I\'m using 24.2.1 and the bug is still here, it only works well <= 24.1.1.
I have an anchored FloatingActionButton
Bug reported and hopefully fixed soon. Please star it.
Well my friend there is another way to it using latest support libraries and not using any other thing .
Just use this -
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_margin="@dimen/activity_horizontal_margin"
android:src="@drawable/ic_add"
android:layout_gravity="center_vertical|center_horizontal"
app:layout_anchor="@+id/appBar"
app:layout_anchorGravity="bottom|right" />
The solution was to set the FloatingActionButton
visibility to GONE
in the XML and when the map is ready set it back to VISIBLE
.
@Override
public void onMapReady(GoogleMap googleMap) {
. . .
yourFAB.setVisibility(View.VISIBLE);
}
EDIT: This is a workaround for this bug.
Marked as Fixed Issue is fixed and released in 26.0.0 version of support library.
As for 5/2/2017 (25.3.1) the bug still hasn't been fixed. After trying all solutions, the only one that worked for me was:
yourView.post(new Runnable() {
@Override
public void run() {
yourView.requestLayout();
}
});
Where yourView
is the anchored view.