Android切换页面功能可以通过以下几种方式实现:
Intent intent = new Intent(CurrentActivity.this, TargetActivity.class);
startActivity(intent);
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.container, new TargetFragment());
fragmentTransaction.commit();
ViewPager viewPager = findViewById(R.id.viewPager);
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(adapter);
// 切换到指定页面
viewPager.setCurrentItem(position);
TabLayout tabLayout = findViewById(R.id.tabLayout);
ViewPager viewPager = findViewById(R.id.viewPager);
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
以上是几种常见的Android页面切换方式,可以根据具体需求选择适合的方式实现页面切换功能。