大马资讯论坛 - 马来西亚中文资讯平台

 找回密码
 注册
搜索
打印 上一主题 下一主题

[解决] Android ActionBar.Tab is not applicable for the arguments new Runnable

[复制链接]
跳转到指定楼层
1#
发表于 2014-6-24 21:54:24 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
The method setTabListener(ActionBar.TabListener) in the type ActionBar.Tab is not applicable for the arguments (new Runnable(){})

Async onPostExecute 错误error
添加 setTabListener(new ActionBar.TabListener() 就能解决以上的error

  1. // For each of the sections in the app, add a tab to the action bar.
  2. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
  3.         // Create a tab with text corresponding to the page title defined by
  4. // the adapter. Also specify this Activity object, which implements
  5. // the TabListener interface, as the callback (listener) for when
  6. // this tab is selected.
  7. actionBar.addTab(actionBar.newTab()
  8.         .setText(mSectionsPagerAdapter.getPageTitle(i))
  9.         .setTabListener(new ActionBar.TabListener() {
  10.                        
  11.                 @Override
  12.                 public void onTabSelected(ActionBar.Tab tab,
  13.                                 FragmentTransaction fragmentTransaction) {
  14.                         // When the given tab is selected, switch to the corresponding page in
  15.                         // the ViewPager.
  16.                         mViewPager.setCurrentItem(tab.getPosition());
  17.                 }
  18.                 @Override
  19.                 public void onTabUnselected(ActionBar.Tab tab,
  20.                                 FragmentTransaction fragmentTransaction) {
  21.                 }
  22.                 @Override
  23.                 public void onTabReselected(ActionBar.Tab tab,
  24.                                 FragmentTransaction fragmentTransaction) {
  25.                 }
  26.         }));
  27. }
复制代码

手机版|大马资讯论坛  

GMT+8, 2024-5-3 11:10 , Processed in 0.018215 second(s), 15 queries , File On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表