0

I have used multiple tab layout activities (ex.5) & multiple image view (ex:5 ).i click (Ex:3) image then open particular tab (Ex:3). how to write code anybody help.Image used in main activity image click enter tab layout particular tab.

Rahul
  • 1,380
  • 1
  • 10
  • 24
Nm Sankar
  • 41
  • 1
  • 7

2 Answers2

0

Use Android TabHost and its method setCurrentTab() in your onCreate()-method.Pass your required tab index to this onCreate()

Shanto George
  • 994
  • 13
  • 26
0

On using ViewPager pass the selected imageview position

    viewPager.setCurrentItem(position, true);

Using TabLayout, add onTabSelectedListener to swipe views

  tabLayout.setOnTabSelectedListener(this);

When it comes to slide

    viewPager.setOnPageChangeListener(
        new ViewPager.SimpleOnPageChangeListener() {
            @Override
            public void onPageSelected(int position) {
                viewPager.setCurrentItem(position);
                tabLayout.setScrollPosition(position, 0f, true);
               }
        });
kIN
  • 14
  • 3