【问题标题】:How to get dynamic activity label based on the matching intent filter如何根据匹配的意图过滤器获取动态活动标签
【发布时间】:2015-04-01 16:42:10
【问题描述】:

我在 Activity 上设置了不同的 Intent 过滤器来处理不同的文件模式。一切正常,但我希望能够根据文件模式在 Android 操作选择器屏幕中显示不同的 Activity 名称。现在,它只显示活动标签...... 是否可以覆盖每个 Intent 过滤器的标签?

【问题讨论】:

    标签: android intentfilter


    【解决方案1】:

    The <intent-filter> element 支持 android:label 属性。

    【讨论】:

    • 谢谢,我发帖后才知道。在此之前我正在将标签添加到操作标签中......
    【解决方案2】:

    也许这就是解决方案:

        ActionBar ab = getActionBar();
        switch(filePattern) {
            case 0:
                ab.setTitle("My Title");
                break;
            ...
            default:
                ab.setTitle("Nothing");
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      • 2022-07-21
      • 1970-01-01
      相关资源
      最近更新 更多