2

API 15 (Galaxy Nexus) avdevice で次のコードを使用しています

menu_share.xml

    <item
    android:id="@+id/menu_share"
    android:actionProviderClass="android.widget.ShareActionProvider"
    android:showAsAction="ifRoom"
    android:title="Share"/>
<item
    android:id="@+id/item1"
    android:orderInCategory="20"
    android:showAsAction="always|collapseActionView"
    android:title="Refresh">
</item>

主な活動はこんな感じ

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.activity_main, menu);

    // Get the ActionProvider
    provider = (ShareActionProvider) menu.findItem(R.id.menu_share)
        .getActionProvider();
    // Initialize the share intent
    intent = new Intent(Intent.ACTION_SEND);

    intent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
    intent.setType("text/plain");
    provider.setShareIntent(intent);
    return true;
}

API 15(Galaxy Nexus)avdで実行すると、クリックできない次のアイコンのみが表示されます(ただし、少なくともメッセージアプリは表示されるはずです)。

API15

API 17 タブレット avd で同じコードを実行すると、SharedActionProvider によって提供されるメッセージング アプリを開始できます。

ここに画像の説明を入力

タブレットでは、このようにメッセージ アプリをドロップダウン リストに表示する方法と、API15 AVD の共有アクション プロバイダーをクリック可能にする方法 (最初の画像) を教えてください。

ありがとう。

4

1 に答える 1

0

これは Android の既知のバグです。ActionBarSherlock の関連するバグ レポートと android のバグ自体を確認してください。バグは 1.5 年前のもので、まだ修正されていません。

于 2013-08-08T10:13:40.607 に答える