比如电话的拨号界面其实是在contacts里面的一个activity来绘制的!
<!-- Tab container for all tabs--> <activity android:name=".dialer.DialerPhoneActivity" android:label="@string/launcherDialer" android:theme="@style/DialtactsTheme" android:launchMode="singleTask" android:clearTaskOnLaunch="true" android:icon="@drawable/ic_launcher_phone" android:screenOrientation="nosensor" > <intent-filter> <action android:name="android.intent.action.DIAL" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="vnd.android.cursor.item/phone" /> <data android:mimeType="vnd.android.cursor.item/person" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.DIAL" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="voicemail" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.DIAL" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.DIAL" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="tel" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="vnd.android.cursor.dir/calls" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.CALL_BUTTON" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> </activity>
那么这样主界面上的Phone图标其实不是对应的Phone.apk的而是Contacts.apk
也就是Contacts.apk对应有多哥ICON入口!
略微的测试一下发现只要在<activity></activity>小小的配置一下就行了!写了一个小例子一个APK对应多个ICON的主要是配置文件如下
<application android:icon="@drawable/icontest1" android:label="@string/app_name1"> <activity android:name="Test1" android:label="@string/app_name1"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Test2" android:icon="@drawable/icontest2" android:label="@string/app_name2" android:screenOrientation="portrait" android:launchMode ="singleInstance"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> </activity>