在xml中设置PreferenceScreen的意图标志

| 我的“ 0”视图是通过XML填充的,在XML中,我包含了“ 1”以导航到系统的同步首选项。 使用下面的代码,它可以正常工作。 我的问题/问题是,当我打开“同步首选项”时,打开主屏幕,然后再次打开我的应用程序,由于“同步设置”位于堆栈顶部,因此已打开。 是否有可能在XML中包含NEW_TASK标志,以告知屏幕这是一项新任务,并且与我的应用程序堆栈没有关联?
<PreferenceScreen
        android:title=\"@string/preferences_activity_syncaccounts_title\"
        android:summary=\"@string/preferences_activity_syncaccounts_summary\"
        android:dialogTitle=\"@string/preferences_activity_syncaccounts_title\">
        <intent
            android:action=\"android.settings.SYNC_SETTINGS\"/>
    </PreferenceScreen>
    
已邀请:
您可以设置android:launchMode = \“ singleInstance \”。 在您的代码示例中,这将是:
    <PreferenceScreen
        android:title=\"@string/preferences_activity_syncaccounts_title\"
        android:summary=\"@string/preferences_activity_syncaccounts_summary\"
        android:dialogTitle=\"@string/preferences_activity_syncaccounts_title\">
    <intent
        android:action=\"android.settings.SYNC_SETTINGS\"
        android:launchMode=\"singleInstance\" />
    </PreferenceScreen>
另一方面,“ singleInstance”活动不允许其他活动成为其任务的一部分。这是任务中唯一的活动。如果启动另一个活动,则该活动将分配给其他任务-就像意图中的FLAG_ACTIVITY_NEW_TASK一样。 您可以在此处了解更多信息:http://developer.android.com/guide/topics/manifest/activity-element.html#lmode     

要回复问题请先登录注册