Gen*_*nik 2 android actionbarsherlock
将此方法添加到我的类时,我收到此错误:
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate your menu.
getSupportMenuInflater().inflate(R.menu.share_action_provider, menu);
// Set file with share history to the provider and set the share intent.
MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);
ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider();
//actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
// Note that you can set/change the intent any time,
// say when the user has selected an image.
actionProvider.setShareIntent(createShareIntent());
return true;
}
Run Code Online (Sandbox Code Playgroud)
以下是我如何声明该类:
public class MainActivity extends SherlockActivity implements ActionBar.OnNavigationListener
Run Code Online (Sandbox Code Playgroud)
我在其他项目中有这个方法,我不会得到那个错误.有谁知道为什么这个错误开始发生在这里?
谢谢!
SherlockActivity确实将这些方法覆盖为final,因此框架可以自行处理.
要解决此问题,只需从Menu,MenuItems等中删除导入,然后从com.sherlockbar导入,因为要覆盖正确的方法.
| 归档时间: |
|
| 查看次数: |
2302 次 |
| 最近记录: |