android - 自定义命名空间支持库 ActionBar?

标签 android xml namespaces

我是一名 Android 初学者程序员,我发现了一些关于此主题的其他问题,但不幸的是,它们不是我要搜索的内容:(。
安卓开发者说:

"If your app is using the Support Library for compatibility on versions as low as Android 2.1, the showAsAction attribute is not available from the android: namespace. Instead this attribute is provided by the Support Library and you must define your own XML namespace and use that namespace as the attribute prefix. (A custom XML namespace should be based on your app name, but it can be any name you want and is only accessible within the scope of the file in which you declare it.)"



我认为命名空间是由标识符唯一标识的一组元素和属性的名称(如果我错了,请纠正我)。那么我是否被迫强制使用“http://schemas.android.com/apk/res-auto”作为命名空间 URI?例如,它是 showAsAction 属性的容器吗?
我希望你回答这两个问题。
非常感谢你,对不起我的英语不好!!

最佳答案

是的,您有义务使用该 URI,因此您可以访问 showAsAction属性,在 Android API 11 之前的版本中。

使用此 URI,您将可以访问支持库自定义属性 showAsAction ,使用自定义命名空间。

在构建时,此 URI 将替换为特定于应用程序的 URI。

关于android - 自定义命名空间支持库 ActionBar?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25331928/

相关文章:

Android 带参数方法的双向数据绑定(bind)

android - Windows Batch - 通过变量传递空间以在 ADB 命令中使用

php - codeigniter 3命名空间问题

c++ - cppcheck生成xml转储文件

python - 安全使用 GAE 应用程序命名空间

sql - 删除重复的和真正冗余的命名空间

android - 如何在 firebase android 的 recyclerview/cardlayout 中将最新帖子显示在顶部而不是底部?

java - Android 错误 : DateFormat() sometimes shows 12hr format, 当它应该显示 24 小时制时

Java XML 到数组

html - 如何用 HTML 和 JavaScript/JQuery 替换数据库以创建动态相关的下拉选择列表?