English 中文(简体)
是否有可能在安纳尼费斯、xml 标签上拥有习俗属性?
原标题:Is it possible to have custom attributes in AndroidManifest.xml tags?

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。

<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")
问题回答

您不能将习俗归结为预先界定的标签,但你可以增加关键价值,称为meta-data

在标签(以及服务和接收器)中,你可以使用标签(http://developer.android.com/guide/topics/mani.4/1999//meta-data-element.html)

它包括名称、价值或资源识别。

您通过一揽子方案管理检索。

如果任何人需要Xamarin(Mono for Anders)I,那么,我会发现它的价值,即128。

我使用了一种“为了”的条件,从0到1 000美元不等,并在MetaData财产不作废时进行检查。 lo





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签