0

I downloaded Pager Sliding Tab Strip sample from GitHub. I want to create a WebView. For example tap Home to bring me to my homepage and tap Top Paid to go to my Forum?Sorry for my newbie question but i am new to this :). Thanks

public class MyPagerAdapter extends FragmentPagerAdapter {

    private final String[] TITLES = { "Categories", "Home", 
            "Top Paid", "Top Free", "Top Grossing", "Top New Paid",
            "Top New Free", "Trending" };

    public MyPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return TITLES[position];
    }

    @Override
    public int getCount() {
        return TITLES.length;
    }

    @Override
    public Fragment getItem(int position) {
        return SuperAwesomeCardFragment.newInstance(position);
    }
}

1 Answers1

0

The PagerSlidingTabStrip is not supposed to work with a WebView, usually you use it in conjunction with a ViewPager.

For what you want to achieve - "when tap Home to bring me to my homepage when tap Top Paid to go to my Forum" - it seems you are talking about a web app. If this is so, then PagerSlidingTabStrip can't help you with this, you'll have to use the web tools (HTML/CSS) to develop the tabs, just like you would build them for a regular web page.

On the other hand if you are looking for something like this, then you'll have to take a look at the ViewPager and ActionBar (or PagerSlidingTabStrip).

Andy Res
  • 15,182
  • 3
  • 55
  • 89
  • Thanks Andy. I want when scroll to Top Paid for example to show Google.com for example.This is not possible for PageSlidingTabStrip?If it possible please someone show the code for that i will be very grateful. – Ивайло Костов Oct 01 '13 at 16:47
  • You could use `PagerSlidingTabStrip` in conjunction with a `ViewPager`, and for every page of ViewPager display a `WebView` that will load a specific web page. That is possible. – Andy Res Oct 02 '13 at 07:25