Search code examples
androidandroid-layoutandroid-widgetandroid-tools-namespace

List of available attributes for tools namespace


I noticed that there are an additional namespace "tools" available for android layouts. Then I tried, but failed :) to find a list of all attributes one can use.

So far I am aware of this:

tools:ignore
tools:listitem

I would like to find a list of all attributes, preferably with some explanations. Also if would be great if someone can tell me what values can I use for tools:ignore.

Thanks in advance.


Solution

  • Here's the gist:

    tools:ignore This attribute can be set on any XML element, and is a comma separated list of lint issue ID's that should be ignored on this element or any of its children, recursively.

    tools:targetApi This attribute is like the @TargetApi annotation in Java classes: it lets you specify an API level, either as an integer or as code name, that this element is known to be running on.

    tools:locale This attribute can be set on the root element in a resource value file and should correspond to a language and optionally a region. This will let tools know what language (locale) the strings in the file are assumed to be. For example, values/strings.xml can have this root element:

    tools:context This attribute is typically set on the root element in a layout XML file, and records which activity the layout is associated with (at designtime, since obviously a layout can be used by more than one layout). This will for example be used by the layout editor to guess a default theme, since themes are defined in the Manifest and are associated with activities, not layouts. You can use the same dot prefix as in manifests to just specify the activity class without the full application package name as a prefix.

    tools:layout This attribute is typically set in a tag and is used to record which layout you want to see rendered at designtime (at runtime, this will be determined by the actions of the fragment class listed by the tag).

    tools:listitem / listheader / listfooter These attributes can be used on a (or other AdapterView children like , etc) to specify layouts to use for the list items, as well as list headers and list footers, at designtime. The tool will fill in dummy data to show a list with some representative contents.

    You can find this list and more here: http://tools.android.com/tech-docs/tools-attributes