2012-11-24 44 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