[英]launch a app splash screen everytime we click a app icon from home screen
SplashActivity
and then loading ActAtomicGodDetailDesc
当前,当我第一次单击应用程序图标时,我正在加载SplashActivity
,然后加载ActAtomicGodDetailDesc
ActAtomicGodDetailDesc
is displaying instead of SplashActivity
现在,当我尽量减少应用程序- >然后进入主屏幕- >然后点击应用程序图标再次ActAtomicGodDetailDesc
的,而不是显示的SplashActivity
Everytime i want the app to fire SplashActivity
when i click the app icon from the home screen 每次我希望从主屏幕上单击应用程序图标时触发该应用程序启动SplashActivity
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:noHistory="true"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ActAtomicGodDetailDesc"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
</application>
Everytime i want the app to fire SplashActivity when i click the app icon from the home screen 每次我希望从主屏幕上单击应用程序图标时触发该应用程序启动SplashActivity
I think you require to set android:clearTaskOnLaunch="true"
on Splash Activity such that whenever you click on app icon then it will start as root activity. 我认为您需要在Splash Activity上设置android:clearTaskOnLaunch="true"
,这样,每当您单击应用程序图标时,它将作为root活动启动。
android:clearTaskOnLaunch http://developer.android.com/guide/topics/manifest/activity-element.html#clear android:clearTaskOnLaunch http://developer.android.com/guide/topics/manifest/activity-element.html#clear
Whether or not all activities will be removed from the task, except for the root activity, whenever it is re-launched from the home screen — "true" if the task is always stripped down to its root activity, and "false" if not. 每当从主屏幕重新启动时,是否将除根活动之外的所有活动都从任务中删除,如果始终将任务剥离到其根活动,则为“ true”,否则为“ false” 。 The default value is "false". 默认值为“ false”。 This attribute is meaningful only for activities that start a new task (the root activity); 此属性仅对启动新任务的活动(根活动)有意义。 it's ignored for all other activities in the task. 该任务中的所有其他活动都将忽略它。 When the value is "true", every time users start the task again, they are brought to its root activity regardless of what they were last doing in the task and regardless of whether they used the Back or Home button to leave it. 当值为“ true”时,无论用户上次在任务中执行什么操作以及是否使用“上一步”或“主页”按钮将其保留,用户每次都再次启动任务时,都会进入其根活动。 When the value is "false", the task may be cleared of activities in some situations (see the alwaysRetainTaskState attribute), but not always. 当值为“ false”时,在某些情况下可以清除任务中的活动(请参阅alwaysRetainTaskState属性),但并非总是如此。
Suppose, for example, that someone launches activity P from the home screen, and from there goes to activity Q. The user next presses Home, and then returns to activity P. Normally, the user would see activity Q, since that is what they were last doing in P's task. 例如,假设某人从主屏幕启动活动P,然后从那里转到活动Q。用户接下来按Home,然后返回到活动P。通常,用户将看到活动Q,因为这就是他们的活动。在P的任务中最后一次做。 However, if P set this flag to "true", all of the activities on top of it (Q in this case) were removed when the user pressed Home and the task went to the background. 但是,如果P将此标志设置为“ true”,则当用户按下Home键并将任务转到后台时,位于其顶部的所有活动(在本例中为Q)都将被删除。 So the user sees only P when returning to the task. 因此,用户在返回任务时只能看到P。
If this attribute and allowTaskReparenting are both "true", any activities that can be re-parented are moved to the task they share an affinity with; 如果此属性和allowTaskReparenting均为“ true”,则任何可以重新建立父级的活动都将移至与它们共享相似性的任务; the remaining activities are then dropped, as described above. 然后,其余活动将被删除,如上所述。
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:clearTaskOnLaunch="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.