Unless otherwise specified, activities within an Android app will default to the icon specified in the application node of the manifest file.
Example: <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > When trying to use a different icon within each unique activity, I noticed specifying it under the application node's android:icon didn't seem to work as it also overrode the application/launcher icon. Apparently, for activity-specific manipulation, you would specify the icon under the android:logo (API level 10+) element instead. Example: <application ... ... > <activity android:name="com.yoursite.yourapps.MainActivity" android:label="@string/app_name"> <intent-filter android:logo="@drawable/customicon"> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> Alternatively, the android:logo can be set in the <application> node to specify the launcher icon, while setting android:icon for custom Activity icons also works.
0 Comments
|
AuthorExploring Android and mobile web design, security, and development. Archives
March 2021
Categories |