Tools Properties Tools Attributes

Source: Internet
Author: User

Android has a dedicated tool class XML namespace that is used to record information in an XML file, and this information is removed when the program is packaged, so it does not burden the runtime and download. The URI for this namespace is http://schemas.android.com/tools, and the common prefix is tools:

<framelayout xmlns:android= "http://schemas.android.com/apk/res/android"    <strong>xmlns:tools= "http ://schemas.android.com/tools "</strong>    android:layout_width=" match_parent "    android:layout_height = "Match_parent" > ...    .
This document documents our commonly used tool class properties (which can often change).

tools: Ignore

This property can be applied on any XML element, and its value is a comma-delimited lint problem ID, indicating that the element and its child elements ignore these issues.

<string name= "Show_all_apps" tools:ignore= "Missingtranslation" >All</string>

For: Lint.

tools: targetapi

This property is like the @targetapi annotation in Java. It lets you specify the API level at which the element runs, either as a numeric value for the API or as a name for the API.

<gridlayout tools:targetapi= "Ice_cream_sandwich" >

For: Lint.

tools: locale

This property can be used on the following element of the resource value file, which corresponds to a language (which can be added to a region). This means that the tool class knows which language (or region) the string in the file is. As an example, values/strings.xml can specify the element

<resources xmlns:tools= "Http://schemas.android.com/tools" <strong>tools:locale= "es" </strong>>

This way we know that the voice used in the default values folder is Spanish, not English.

for: Lint,studio (turn off spell checking in resource files) .


The others are not translated:

Tools: context the theme used for layout guessing when previewing layouts. Because topics are typically specified in the manifest file, and the topic is associated with the activity, not layout.
<android.support.v7.widget.gridlayout xmlns:android= "Http://schemas.android.com/apk/res/android" xmlns:tools= "Http://schemas.android.com/tools"    

Tools:layout

Used on the <fragment> tab to specify layout for design-time designer rendering.

<fragment android:name= "com.example.master.ItemListFragment" <strong>tools:layout= "@android: layout/list _content "</strong>/>

other, not much to say :

tools: listitem / listheader / listfooter tools: showin Tools: Menu tools: actionbarnavmode



designtime Layout Attributes

You can use the Tools:xxxxx property to specify the Android:xxxxx property at design time.


You first have to add a namespace to the layout file:

<linearlayout        xmlns:android= "http://schemas.android.com/apk/res/android"       <strong> xmlns:tools= "Http://schemas.android.com/tools" </strong>        android:layout_width= "Match_parent"        ...


For example, to make TextView display "AAA" At design time, the string is not displayed when it is officially run. As long as this:

<textview      <strong>       tools:text= "AAA" </strong>            android:layout_width= "Wrap_content"            android:layout_height= "Wrap_content"/>







Tools Properties Tools Attributes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.