4

更新
到目前为止,这只发生在使用 Android 4.0.3 的 HTC OneX 上

我在 android 共享菜单中有两个共享到菜单项。

当用户从 android 图库分享图像时,我的应用程序会显示两个
图标,因此用户可以轻松访问我的应用程序的两个不同部分。见图片。

这在 API v8 中运行良好,但在真实设备上的 API v15中缺少其中一个。API v15 模拟器没问题!

在我的AndroidManifest.xml这两个Activity's中设置了一个图标在共享菜单中。

 - ActivityMainLauncher   
 - ActivityQuickLauncher

图像位于hdpimdpildpi文件夹中。
大小为 72、48、36 像素,它们是PNG图像。
Photoshop 为所有三张图像显示相同的分辨率 72,009。
更新
为 96pix 添加了 drawable-xhdpi 文件夹,但我仍然只有一项:“SPRiiD”

这种行为太奇怪了,我不知道从哪里开始调试。我认为我监督的 API v15 中有一些新内容?

模拟器 API v15 的图像正确显示了这两个选项。

在此处输入图像描述

这是我的AndroidManifest.xml文件。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:installLocation="internalOnly"
    package="com.carlsberg.dumbo"
    android:versionCode="12"
    android:versionName="0.83" >

<!-- android:versionCode as the basis for identifying the application internally and handling updates, -->
<!-- android:versionName to users as the application's version -->
<permission
    android:name="com.carlsberg.dumbo.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />

<supports-screens android:anyDensity="true" />

<uses-permission android:name="com.carlsberg.dumbo.permission.C2D_MESSAGE" />
<!-- <uses-permission android:name="android.permission.SET_DEBUG_APP"></uses-permission> -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" >
</uses-permission>

<uses-sdk android:minSdkVersion="8" />

<application
    android:icon="@drawable/launcher_gallery"
    android:label="@string/string_app_name" >
    <activity
        android:name=".ActivityMainLauncher"
        android:configChanges="keyboardHidden|orientation"
        android:icon="@drawable/launcher_gallery"
        android:label="@string/string_app_name"
        android:launchMode="singleTop" >
        <intent-filter>
            <action android:name="android.intent.action.SEND" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:mimeType="image/*" />
            <data android:mimeType="video/*" />
            <data android:mimeType="audio/*" />
            <data android:mimeType="text/*" />
            <data android:mimeType="application/*" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.SEND_MULTIPLE" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:mimeType="image/*" />
            <data android:mimeType="video/*" />
            <data android:mimeType="audio/*" />
            <data android:mimeType="text/*" />
            <data android:mimeType="application/*" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity-alias
        android:name="com.android.internal.app.ResolverActivity"
        android:exported="true"
        android:targetActivity=".ActivityMainLauncher" />

    <activity
        android:name=".gallery.ActivityGallery"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:configChanges="orientation|keyboardHidden"
        android:icon="@drawable/launcher_gallery"
        android:label="@string/string_app_name_gallery"
        android:launchMode="singleTop"
        android:taskAffinity="com.carlsberg.dumbo.GalleryActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".ActivityQuickLauncher"
        android:configChanges="keyboardHidden|orientation"
        android:icon="@drawable/launcher_gallery"
        android:label="@string/string_app_name_quick_launcher"
        android:launchMode="singleTop" >
        <intent-filter>
            <action android:name="android.intent.action.SEND" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:mimeType="image/*" />
            <data android:mimeType="video/*" />
            <data android:mimeType="audio/*" />
            <data android:mimeType="text/*" />
            <data android:mimeType="application/*" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.SEND_MULTIPLE" />

            <category android:name="android.intent.category.DEFAULT" />

            <data android:mimeType="image/*" />
            <data android:mimeType="video/*" />
            <data android:mimeType="audio/*" />
            <data android:mimeType="text/*" />
            <data android:mimeType="application/*" />
        </intent-filter>
    </activity>

    <activity
        android:name=".send.ActivitySend"
        android:configChanges="orientation|keyboardHidden"
        android:launchMode="singleTask"
        android:screenOrientation="portrait" >
    </activity>
    <activity
        android:name=".ActivityRemoveFriend"
        android:configChanges="keyboardHidden|orientation"
        android:label="@string/string_app_name"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name="com.carlsberg.dumbo.history.TabActivityHistoryLauncher"
        android:label="@string/string_app_name"
        android:launchMode="singleTask" >
    </activity>
    <activity android:name="com.carlsberg.dumbo.history.ActivityTabGroup1" >
    </activity>
    <activity android:name="com.carlsberg.dumbo.history.ActivityTabGroup2" >
    </activity>
    <activity android:name="com.carlsberg.dumbo.history.ActivityHistoryOutgoing" >
    </activity>
    <activity android:name="com.carlsberg.dumbo.history.ActivityHistoryIncoming" >
    </activity>
    <activity
        android:name=".ActivityLogin"
        android:configChanges="keyboardHidden|orientation"
        android:label="@string/string_app_name"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name=".ActivityAddFriend"
        android:configChanges="keyboardHidden|orientation"
        android:label="@string/string_app_name"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity
        android:name=".ActivityAcceptFriend"
        android:configChanges="keyboardHidden|orientation"
        android:label="@string/string_app_name"
        android:theme="@android:style/Theme.Dialog" >
    </activity>
    <activity android:name=".Preferences" >
    </activity>
    <activity
        android:name=".send.TabActivityActivityHelpSend"
        android:launchMode="singleTask"
        android:screenOrientation="portrait" >
    </activity>


    <service
        android:name=".IntentServiceSendFiles"
        android:label="@string/string_sendFileService" >

    </service>
    <service
        android:name=".IntentServiceGetFilesFromPc"
        android:label="@string/string_getFileService" >
    </service>        
    <service
        android:name=".IntentServiceGetFiles"
        android:label="@string/string_getFileService" >
    </service>
    <service
        android:name=".ServiceBootCompleated"
        android:label="@string/string_batchtester" >
    </service>
    <service
        android:name=".IntentServiceGetFriendList"
        android:label="@string/string_listupdater" >
    </service>
    <service
        android:name=".IntentServiceUpdateFriendList"
        android:label="@string/string_listupdater" >
    </service>
    <service android:name=".C2DMReceiver" />

    <receiver
        android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND" >
        <intent-filter>

            <!-- Receive the actual message -->
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />

            <category android:name="com.carlsberg.dumbo" />
        </intent-filter>
        <intent-filter>

            <!-- Receive the registration id -->
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />

            <category android:name="com.carlsberg.dumbo" />
        </intent-filter>
    </receiver>
    <receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver" >

        <!-- Handle retry events -->
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RETRY" />

            <category android:name="com.carlsberg.dumbo" />
        </intent-filter>
    </receiver>
    <receiver android:name=".AlarmReceiver" >
    </receiver>
    <receiver android:name=".myBroadcastReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

    <provider
        android:name=".contentprovider.UserContentProvider"
        android:authorities="com.carlsberg.dumbo.contentprovider" >
    </provider>
</application>

4

1 回答 1

1

我刚刚复制了清单的相关部分并创建了一个测试项目:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ActivityMainLauncher"
            android:configChanges="keyboardHidden|orientation"
            android:icon="@drawable/ic_launcher"
            android:label="@string/string_app_name"
            android:launchMode="singleTop" >
            <intent-filter>
                <action android:name="android.intent.action.SEND" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="image/*" />
                <data android:mimeType="video/*" />
                <data android:mimeType="audio/*" />
                <data android:mimeType="text/*" />
                <data android:mimeType="application/*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND_MULTIPLE" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="image/*" />
                <data android:mimeType="video/*" />
                <data android:mimeType="audio/*" />
                <data android:mimeType="text/*" />
                <data android:mimeType="application/*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ActivityQuickLauncher"
            android:configChanges="keyboardHidden|orientation"
            android:icon="@drawable/ic_launcher"
            android:label="@string/string_app_name_quick_launcher"
            android:launchMode="singleTop" >
            <intent-filter>
                <action android:name="android.intent.action.SEND" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="image/*" />
                <data android:mimeType="video/*" />
                <data android:mimeType="audio/*" />
                <data android:mimeType="text/*" />
                <data android:mimeType="application/*" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.SEND_MULTIPLE" />

                <category android:name="android.intent.category.DEFAULT" />

                <data android:mimeType="image/*" />
                <data android:mimeType="video/*" />
                <data android:mimeType="audio/*" />
                <data android:mimeType="text/*" />
                <data android:mimeType="application/*" />
            </intent-filter>
        </activity>
    </application>

</manifest>

简单的活动实现:

public class ActivityQuickLauncher extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Toast.makeText(this, getClass().getName(), Toast.LENGTH_LONG).show();
    }
}

public class ActivityMainLauncher extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Toast.makeText(this, getClass().getName(), Toast.LENGTH_LONG).show();
    }
}

它有效:

安卓 4.1.1 安卓 4.0.3

Android 4.1.1 (Galaxy Nexus) 和 Android 4.0.3 (Archos G9 A70)。

于 2012-07-13T09:09:47.267 回答