由网友(想要住進你心裡)分享简介:我想自定义属性添加到我的AndroidManifest.xml文件的应用程序标签。在Android环境中这可能吗?I would like to add a custom attribute to the application tag of my AndroidManifest.xml file. Is thi...
我想自定义属性添加到我的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")
相关推荐
最新文章