【问题标题】:Android pick activity text colorAndroid 选择活动文本颜色
【发布时间】:2012-11-12 11:06:48
【问题描述】:

我的选择活动有问题,我有这个弹出窗口:

文本颜色也是白色和背景。 这是我使用的代码:

    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);

【问题讨论】:

  • 我对 Android 4.2 有同样的问题,我想我会自己实现列表。您可以从 PackageManager.queryIntentActivities() 获取项目对于 Android 实现看这里:github.com/android/platform_packages_apps_settings/blob/master/…
  • 是的,它在 4.2.1 中仍然存在问题。
  • 谢谢!!!我将实现我的对话框
  • 我在我的应用汽车仪表板中遇到了同样的问题。在 Android 4.1 中运行良好,但 Android 4.2 在白色背景上显示相同的白色文本。
  • 在 4.2.2 中仍然损坏 :(

标签: android android-intent android-activity shortcuts


【解决方案1】:

我终于得到了解决方案:

你需要使用

Intent pickIntent = new Intent(Intent.ACTION_CHOOSER);

其余的还是一样的。 此代码将为您提供 Holo 对话框。

【讨论】:

  • 如果您需要在实际启动之前对所选活动执行某些操作,例如将资源的权限授予将持续存在的活动包(如使用意图使用Intent.FLAG_GRANT_READ_URI_PERMISSION 可能会在 Activity 在其生命周期之外保留 URI 时导致问题,例如使用电子邮件附件等,并且在 Jelly Bean 之前它不适用于存储在 Extras 中的 URI) .
猜你喜欢
  • 2012-12-14
  • 1970-01-01
  • 1970-01-01
  • 2016-02-12
  • 1970-01-01
  • 2010-09-27
  • 2022-01-20
  • 2014-12-17
  • 2013-04-28
相关资源
最近更新 更多