首页新闻找找看学习计划

怎么监听PagerTitleStrip的点击事件?

0
悬赏园豆:10 [待解决问题]
public void vpSet() {
        viewPager = (ViewPager)findViewById(R.id.vpWelcome);
        pagerTitle = (PagerTitleStrip)findViewById(R.id.ptWelcome);
        
        //添加页面
        inflater = LayoutInflater.from(this);
        view1 = inflater.inflate(R.layout.welcome_vp_1, null);
        view2 = inflater.inflate(R.layout.welcome_vp_2, null);
        view3 = inflater.inflate(R.layout.welcome_vp_3, null);
        views = new ArrayList<View>();
        views.add(view1);
        views.add(view2);
        views.add(view3);
        
        //添加页面标题
        titles = new ArrayList<String>();
        titles.add(getString(R.string.welcome));
        titles.add(getString(R.string.help));
        titles.add(getString(R.string.start));
        
        //添加数据适配器
        PagerAdapter pagerAdapter = new PagerAdapter() {
            @Override
            public int getCount() {
                return views.size();
            }
            @Override
            public CharSequence getPageTitle(int position) {
                return titles.get(position);
            }
            @Override
            public Object instantiateItem(View view, int position) {
                ((ViewPager)view).addView(views.get(position));
                return views.get(position);
            }
            @Override
            public void destroyItem(View view, int position, Object object) {
                ((ViewPager)view).removeView(views.get(position));
            }
            @Override
            public boolean isViewFromObject(View view, Object object) {
                return view == object;
            }
        };
        viewPager.setAdapter(pagerAdapter);
    }

部分代码如上
我不想用几个testview做viewPager的标题,但是又想达到点击某个标题就能跳转到那个界面的效果
用PagerTitleStrip怎么实现这个效果啊?
还是小白一只,麻烦说详细一点,谢谢啦~

Tony竹的主页 Tony竹 | 初学一级 | 园豆:192
提问于:2013-01-31 19:18
< >
分享
所有回答(1)
0

PaperTitleStrip是什么东西?
viewPager又是什么东西?

Juwendcnblgs | 园豆:245 (菜鸟二级) | 2013-02-24 16:43
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册