Answer the question
In order to leave comments, you need to log in
How to properly work with floatingActionButton in viewPager? What am I doing wrong?
Good afternoon! I have a viewPager with a FragmentStatePagerAdapter, at the viewPager level I created a FloatingActionButton in xml. The viewPager has items with the same type of content and the items are just a fragment that is filled depending on the position of the viewPager.
private class ViewPagerAdapter extends FragmentStatePagerAdapter {
@Override
public Fragment getItem(int position) {
Bundle bundle = new Bundle();
bundle.putInt(POSITION, position);
ItemViewPagerFragment fragment = new ItemViewPagerFragment();
fragment.setArguments(bundle);
return fragment;
}
}
FloatingActionButton floatingActionButton = getActivity().findViewById(R.id.fab);
floatingActionButton.setOnClickListener(this);
private void startNewVisitDoc() {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.addToBackStack(null)
.replace(R.id.contentMain, new ClientViewPagerContainer())
.commit();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question