2

Hello i have a problem with hide BottomNavigationView from fragment on WebView scroll below my code

Main Activity

@SuppressLint("Assert")
public void hideBottomNavigationView(boolean b) {
    if (b)
    {
        BottomNavigationView Bview = null;
        assert false;
        Bview.clearAnimation();
        Bview.animate().translationY(Bview.getHeight()).setDuration(300);
    }
    else
    {
        BottomNavigationView Bview = null;
        assert false;
        Bview.clearAnimation();
        Bview.animate().translationY(0).setDuration(300);
    }
}

Fragment

webView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
        @Override
        public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
            if (scrollY>200)
            {
                ((MainActivity)getActivity()).hideBottomNavigationView(true);
            }
            else
            {
                ((MainActivity)getActivity()).hideBottomNavigationView(false);
            }
        }
    });

I don't know where i am doing wrong please help me to hiding BottomNavigation from fragment.

Elio Lako
  • 1,333
  • 2
  • 16
  • 26

0 Answers0