使用pagerslidingtabstrip获取类强制转换异常的选项卡

时间:2015-07-28 14:41:04

标签: android tabs swipe pagerslidingtabstrip

任何人都可以帮助我在android中集成pagerslidingtabstrip(Tab with swipe) 我正在

Caused by: java.lang.ClassCastException: com.astuetz.PagerSlidingTabStrip cannot be cast to com.*.*.PagerSlidingTabStrip
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    // Get the ViewPager and set it's PagerAdapter so that it can display items
    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    viewPager.setAdapter(new SampleFragmentPagerAdapter(getSupportFragmentManager()));

    // Give the PagerSlidingTabStrip the ViewPager
    PagerSlidingTabStrip tabsStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    // Attach the view pager to the tab strip
    tabsStrip.setViewPager(viewPager);
}

提前致谢,

0 个答案:

没有答案