Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FloatingActionButton can't show/hide after call setFab() #54

Open
jordenchang55 opened this issue Jul 12, 2016 · 3 comments
Open

FloatingActionButton can't show/hide after call setFab() #54

jordenchang55 opened this issue Jul 12, 2016 · 3 comments
Labels
Milestone

Comments

@jordenchang55
Copy link

I have 4 fragments and use BottomNavigation to switch between them.
In some fragments, I don't want to use fab, so I try to call mFAB.hide() to hide it.
No matter I call this method in activity or fragment, it just doesn't work, the button still there.

But if I remove the line,
mBottomNavigationBar.setFab(mFAB),
the button will show/hide as expected when switching between tabs.

@Ashok-Varma
Copy link
Owner

The Bug is due to animations. mFab.hide() uses animation to hide the fab. But at the same time since bottomBar state changed it is trying to animate fab cancelling previous animation so hide animation is stopped. i will try to fix it in upcoming release.
for now instead of

mFAB.hide()

try to call

mFAB.setVisibility

@Ashok-Varma Ashok-Varma added this to the 1.3.1 milestone Jul 12, 2016
@Ashok-Varma Ashok-Varma modified the milestones: 2.1.0, 1.3.1 Jun 24, 2017
@SailFlorve
Copy link

Yeah I have the same case and met this bug, longing for fixing it!

@ahmadmust8
Copy link
Contributor

it work if you write it like this

override fun onTabSelected(position: Int) {
       
       if (position == 2){
            fab.visibility = View.GONE
        }else{
            fab.visibility = View.VISIBLE
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants