Android Basics Getting Started tutorial--2.2.6 absolutelayout (Absolute layout)

Source: Internet
Author: User

Android Basics Getting Started tutorial--2.2.6 absolutelayout (Absolute layout)

tags (space delimited): Android Basics Getting Started Tutorial

Introduction to this section:

The top five layouts in Android are described earlier, and the sixth layout absolutelayout (absolute layout) is explained in this section.
The reason to put this to the last, because the absolute layout, we are basically not used, of course, you can skip this
Blog post, but as a programmer who likes to grow posture, we can still understand this absolutelayout layout,
I believe most of the Java-learning know that we have used this absolute layout in Java Swing (not spring), but Android
The reason we use this less is because the applications we develop need to be adapted to a number of models, if you
Using this absolute layout, you may be on the 4-inch mobile phone is displayed normal, and replaced by 5-inch mobile phone, it may be offset
And deformation, so the words, this is still not recommended to use, of course, if you do not write code, and want to play Android, then write
In the layout, you can drag the required components to the interface via ADT! This absolutelayout is directly through the x, Y coordinates
Control the position of the component in the activity! The other one, but the unit is dp!.

1. The four control attributes (Units are DP):

① Control Size:
android:layout_width: component width android:layout_height: Component Height
② control Position:
android:layout_x: Sets the x-coordinate of the component android:layout_y: Sets the y-coordinate of the component

2. Examples of use:

A simple login interface, which is simply dragged out of the ADT interface, is not affixed to the code:

① first set to absolutelayout absolute layout:

② drag two TextView and EditText from the left and a button to the interface, dragged and dragged to find out what looks good.

Drag-and-drop, and finally this is a setback, estimated to be ADT problem, next you can:
① the code to change the coordinates, know it looks good.
② of course, you can also set the coordinates directly on the right:

When you are finished modifying:

Of course, perhaps the above two methods do not like, you want to drag and then directly generate the correct code ~!
OK, no problem, we recommend that you use the previous interface prototype to introduce a tool: DroidDraw

Summary of this section

OK, the six major layouts in Android have been introduced, or recommended: LinearLayout's weight weight attribute +
Relativelayout to build our interface ~ Well, here it is, thank you ~

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android Basics Getting Started tutorial--2.2.6 absolutelayout (absolute layout)

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.