English 中文(简体)
“Rodid:”前身是指和roid框架-res模块
原标题:What is "android:" prefix mean in android framework-res module

我从框架单元的风格、xml文档中复制这一代码。

<style name="Theme">

    <item name="colorForeground">@android:color/bright_foreground_dark</item>
    <item name="colorForegroundInverse">@android:color/bright_foreground_dark_inverse</item>
    <item name="colorBackground">@android:color/background_dark</item>

<style name="Theme。Black">
    <item name="android:windowBackground">@android:color/black</item>
    <item name="android:colorBackground">@android:color/black</item>
</style>

As you see, they all have a attribute name which s value is windowBackground。 But the formar has a android: and the latter doesn t。 Is it really necessary to write a android: prefix in android framework?

最佳回答

Found this to be an interesting question and tried exploring to find the answer.. This is what I found..

http://developer.android.com/guide/topics/resources/e-resource.html

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style
        name="style_name"
        parent="@[package:]style/style_to_inherit">
        <item
            name="[package:]style_property_name"
            >style_value</item>
    </style>
</resources>

item - Defines a single property for the style. Must be a child of a element. attributes: name Attribute resource. Required. The name of the style property to be defined, with a package prefix if necessary (for example android:textColor).

http://developer.android.com/guide/topics/mani.4/1999//mani.4/1999/-intro.html” rel=“noreferer”http://developer.android.com/guide/topics/mani/pop-intro.html

Resource values Some attributes have values that can be displayed to users — for example, a label and an icon for an activity. The values of these attributes should be localized and therefore set from a resource or theme. Resource values are expressed in the following format,

@[package:]type:name

where the package name can be omitted if the resource is in the same package as the application, type is a type of resource — such as "string" or "drawable" — and name is the name that identifies the specific resource. For example: Values from a theme are expressed in a similar manner, but with an initial ? rather than @ :

?[package:]type:name

最后,我尝试在没有刺.的情况下给予其属性:尽管它成功地进行了汇编,但还是提出了例外。

问题回答

<>载体>

安德列包含一些标准资源,如风格、主题和布局。 为了获得这些资源,你的资源参考符合海底包裹的名称。 例如,Andan提供一种可供你使用的布局资源,用于列入<编码>的物项清单。 清单Adapter:

setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, myarray));

举例来说,简单的清单_项目1是平台为<代码>中的项目确定的一种非专用资源。 清单。 你们可以这样做,而不是为自己设定清单项目。 (关于使用<代码>ListView的更多信息,见《清单》。)





相关问题
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 ...

热门标签