An explanation of XML tools properties in Android

Source: Internet
Author: User

The first part

In Android development, when writing layout code, the IDE can see the layout Preview. However, some effects must be run before they can be seen, like this: TextView does not set any characters in the XML, but instead sets the text in the activity. So in order to preview the effect in the IDE, you have to set the Android:text property for the TextView control in the XML, generally we tell ourselves when we do this, it's okay, and I'll delete all of this when I finish writing the code. But you may forget that there is such a code in your final product.

the above situation can be avoided and we use Tools namespace and its properties to solve this problem. xmlns:tools= "http://schemas.android.com/tools", tools can tell Android Studio which properties are ignored at run time, Only works when layout is designed.

Types of tools Properties

The tools attribute can be divided into two types: one that affects Lint hints, and one that is about XML layout design. The above introduction is the most basic use of tools: in the UI design to cover the standard Android properties, belong to the second type. The lint related properties are described below.

Lint properties related to

Tools:ignore

Tools:targetapi

Tools:locale

Part II

In this section we will continue to introduce other properties about UI previews (not standard Android properties).

Tools:context

Tools:menu

Tools:actionbarnavmode

Tools:listitem/listheader/listfooter

Tools:showin

Tools:layout

Original Address : http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0309/2567.html

An explanation of XML tools properties in Android

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.