是否有可能在AndroidManifest.xml中标记的自定义属性? [英] Is it possible to have custom attributes in AndroidManifest.xml tags?
本文介绍了是否有可能在AndroidManifest.xml中标记的自定义属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想自定义属性添加到我的AndroidManifest.xml文件的应用程序标签。在Android环境中这可能吗?
I would like to add a custom attribute to the application tag of my AndroidManifest.xml file. Is this possible in the Android environment?
推荐答案
是的。下面是一个例子。自定义标记是 ContentVersion
。
Yes. Here's an example. The custom tag is ContentVersion
.
<application android:name=".MyApplication"
android:icon="@drawable/icon"
android:label="@string/app_name">
<meta-data android:name="ContentVersion" android:value="1.9" />
<activity android:name="com.someone.something.MainActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:screenOrientation="sensor"
android:label="@string/app_name">
要访问它:
ApplicationInfo ai = _context.getPackageManager().getApplicationInfo(_context.getPackageName(),PackageManager.GET_META_DATA);
ai.metaData.get("ContentVersion")
这篇关于是否有可能在AndroidManifest.xml中标记的自定义属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文