Bug with anchored FloatingActionButton in support library 24.2.1

前端 未结 5 2519
一整个雨季
一整个雨季 2021-02-19 16:45

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

相关标签:
5条回答
  • 2021-02-19 17:25

    Bug reported and hopefully fixed soon. Please star it.

    0 讨论(0)
  • 2021-02-19 17:32

    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" />
    
    0 讨论(0)
  • 2021-02-19 17:34

    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.

    0 讨论(0)
  • 2021-02-19 17:34

    Marked as Fixed Issue is fixed and released in 26.0.0 version of support library.

    0 讨论(0)
  • 2021-02-19 17:38

    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.

    0 讨论(0)
提交回复
热议问题