2012-11-24 87 views
6

我有挑選性的問題,我有這個彈出:Android的選秀活動文本顏色

enter image description here

文本顏色爲白色,背景太。 這是代碼我使用:

Bundle bundle = new Bundle(); 
    ArrayList<String> shortcutNames = new ArrayList<String>(); 
    shortcutNames.add(getString(R.string.group_applications)); 
    bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames); 

    ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>(); 
    shortcutIcons.add(ShortcutIconResource.fromContext(this, 
      R.drawable.ic_launcher)); 
    bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons); 

    Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY); 
    pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT)); 
    pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.app_name)); 
    pickIntent.putExtras(bundle); 

    startActivityForResult(pickIntent, 1); 
+2

我有與Android 4.2相同的問題我想我會自己實現列表。你可以從PackageManager.queryIntentActivities()獲得項目() 對於Android實現,請看這裏:https://github.com/android/platform_packages_apps_settings/blob/master/src/com/android/settings/ActivityPicker.java – Alex

+0

是的,它仍然是在4.2.1中破碎。 – soundmaven

+0

謝謝!我將執行我的對話 – jaumard

回答

0

我終於得到了解決:

您需要使用

Intent pickIntent = new Intent(Intent.ACTION_CHOOSER); 

其餘的仍然是相同的。 此代碼將爲您提供Holo對話框。

+0

)這仍然沒有幫助,如果您需要在實際啓動之前對所選活動執行某些操作,例如爲將保留的活動包授予對資源的權限(如使用Intent.FLAG_GRANT_READ_URI_PERMISSION'的意圖可能會導致問題,如果活動在其生命週期之外持有URI,例如附件用於電子郵件等,並且在Jelly Bean之前,它對存儲的URI不起作用無論如何在附加)。 – JAB