Android UI Layout Experience Summary

Source: Internet
Author: User

1. Guidelines for drawing the UI

Can contributors Jane, can use a control to fix things, do not use multiple controls.

Can be pumped, you can extract the properties of reuse or layout to extract.


3. Resources

in Android projects, resources are placed under the Res folder, resources can be pictures, XML, etc., and different types of resources are placed in different

File, as shown in

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/71/17/wKiom1XFPyvD-Hm-AAFACGdoPp4287.jpg "title=" Resource directory. PNG "alt=" Wkiom1xfpyvd-hm-aafacgdopp4287.jpg "/>

You can @[android:]anim/when you reference it.

@[android:]drawable/

@[android:]layout/

@[android:]menu/

@[android:]layout/

@[android:]menu/

@[android:]style/

@[android:]string/

@[android:]color/

If you add Android: Represents a resource that calls the system, the system itself has some very common, rich resources (including images

layouts, animations, etc.), for some demo demos, you can call the system's resources directly to save time.


3. Status Selector Selector

Role: Manage resources (pictures, colors) to display resources based on the state in which the control is located.

Application scenarios: such as when TextView click, change the color or background, you can let users know there is no click on.

To define the steps:

1) Create an XML file in the Res/drawable directory and select the selector tag.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/13/wKioL1XFNGihzyqCAAGjyxNLvcI739.jpg "title=" Picture 4.png "alt=" Wkiol1xfngihzyqcaagjyxnlvci739.jpg "/>

Clicking Finish will automatically generate the following XML file:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/71/17/wKiom1XFMtrDs62dAAC8FdZs1eo263.jpg "title=" Picture 5.png "alt=" Wkiom1xfmtrds62daac8fdzs1eo263.jpg "/>

2) Defines the item label, which represents the resource that the selector points to in different states.

Item can point to a drawable resource or to a color resource (you cannot write a color value directly,

Color tag).

There are many states of item, some transient, temporary state (such as pressed, etc.), some permanent state

(such as enabled, selected, etc.).

There can be more than one item in an XML file, but the default item (without state) must be put to the last

(Never mind)

The resources for each item in the XML can be consistent, either drawable or color, or it can be

Drawable is also color, as long as the properties that bind the selector support both the picture and the color, such as background.

Example 1: Selectors that point to a color resource


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/71/14/wKioL1XFN1GDlSvAAACsYrKfs_8814.jpg "title=" Picture 6.png "alt=" Wkiol1xfn1gdlsvaaacsyrkfs_8814.jpg "/>

Example 2: selector for a drawable resource

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/71/14/wKioL1XFO1DA7dKOAACNAHCVcJY430.jpg "title=" Picture 7.png "alt=" Wkiol1xfo1da7dkoaacnahcvcjy430.jpg "/>


This article is from the "line of the World" blog, please be sure to keep this source http://4259297.blog.51cto.com/4249297/1682845

Android UI Layout Experience Summary

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.