Answer the question
In order to leave comments, you need to log in
How to load PreferenceFragment in BottomNavigationView?
To switch between windows using BottomNavigationView, you need to load fragments in FrameLayout.
It looks something like this:
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
loadFragment(MainFragment.newInstance());
return true;
case R.id.navigation_personel:
loadFragment(PersonelFragment.newInstance());
return true;
case R.id.navigation_charts:
loadFragment(ChartFragment.newInstance());
return true;
case R.id.navigation_tables:
loadFragment(TableFragment.newInstance());
return true;
case R.id.action_settings:
return true;
}
return false;
}
};
private void loadFragment(Fragment fragment) {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.content, fragment);
ft.commit();
}
Answer the question
In order to leave comments, you need to log in
preference fragment это унылое говно, лучше вообще его не использовать.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question