我是一个菜鸟开发人员...我希望有人可以帮助我解决这个问题。我要在我的操作栏 (ABS) 中添加一个分享按钮,但我有一些问题
我的操作栏菜单 XML
<?xml version="1.0" encoding="utf-8"?>
<item android:id="@+id/menu_item_share"
android:title="Share"
android:showAsAction="ifRoom"
android:actionProviderClass="com.actionbarsherlock.widget.ShareActionProvider" />
我的活动
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.widget.ShareActionProvider;
public class DisPlayWebPageActivity extends SherlockActivity {
WebView webview;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
...
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.actionmenu, menu);
ShareActionProvider myShareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_item_share).getActionProvider();
Intent myIntent = new Intent();
myIntent.setAction(Intent.ACTION_SEND);
myIntent.putExtra(Intent.EXTRA_TEXT, "page_url");
myIntent.setType("text/plain");
myShareActionProvider.setShareIntent(myIntent);
return true;
}
相关错误
Error:(52, 8) java: com.actionbarsherlock.internal.view.menu.MenuBuilder is not abstract and does not override abstract method getItem(int) in com.actionbarsherlock.view.Menu
Error:(663, 34) java: getItem(int) in com.actionbarsherlock.internal.view.menu.MenuBuilder cannot implement getItem(int) in com.actionbarsherlock.view.Menu
return type android.view.MenuItem is not compatible with com.actionbarsherlock.view.MenuItem
Error:(605, 34) java: findItem(int) in com.actionbarsherlock.internal.view.menu.MenuBuilder cannot implement findItem(int) in com.actionbarsherlock.view.Menu
return type android.view.MenuItem is not compatible with com.actionbarsherlock.view.MenuItem
Error:(443, 33) java: addSubMenu(int,int,int,int) in com.actionbarsherlock.internal.view.menu.MenuBuilder cannot implement addSubMenu(int,int,int,int) in com.actionbarsherlock.view.Menu
return type android.view.SubMenu is not compatible with com.actionbarsherlock.view.SubMenu
Error:(435, 33) java: addSubMenu(int,int,int,java.lang.CharSequence) in com.actionbarsherlock.internal.view.menu.MenuBuilder cannot implement addSubMenu(int,int,int,java.lang.CharSequence) in com.actionbarsherlock.view.Menu
return type android.view.SubMenu is not compatible with com.actionbarsherlock.view.SubMenu
...
问我是否需要完整的错误日志!