. Net programmers play Android Development --- (9) Absolute layout of AbsoluteLayout, android programmers

Source: Internet
Author: User

. Net programmers play Android Development --- (9) Absolute layout of AbsoluteLayout, android programmers

The absolute layout of AbsoluteLayout is similar to that. NET Winform layout, with the coordinate point in the upper left corner of the form, extending to the right. since the absolute layout of each control is fixed and cannot be changed with the screen size, the running effect on different devices is different, so this layout method is used less.

The controls in the absolute layout AbsoluteLayout have two important attributes: layout_x and layout_y, respectively, used to set the absolute position of the control.


Let's take a look at the layout effect of this example.

<? Xml version = "1.0" encoding = "UTF-8"?> <AbsoluteLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "match_parent" android: layout_height = "match_parent"> <ImageView android: id = "@ + id/imageView1" android: layout_width = "96dp" android: layout_height = "96dp" android: layout_x = "0dp" android: layout_y = "3dp" android: src = "@ raw/pad"/> <TextView android: id = "@ + id/textView2" android: layout_width = "120dp" android: layout_height = "wrap_content" android: layout_x = "110dp" android: layout_y = "78dp" android: text = "color: White"/> <TextView android: id = "@ + id/textView2" android: layout_width = "120dp" android: layout_height = "wrap_content" android: layout_x = "110dp" android: layout_y = "47dp" android: text = "product price: $19 "/> <TextView android: layout_width =" 120dp "android: layout_height =" wrap_content "android: layout_x =" 110dp "android: layout_y =" 16dp "android: text = "Product Name: Ipad Air"/> <TextView android: id = "@ + id/textView1" android: layout_width = "match_parent" android: layout_height = "3dp" android: layout_x = "0dp" android: layout_y = "118dp" android: background = "# EEE8CD" android: text = ""/> <ImageView android: id = "@ + id/ImageView01" android: layout_width = "96dp" android: layout_height = "96dp" android: layout_x = "9dp" android: layout_y = "137dp" android: src = "@ raw/pad"/> <TextView android: layout_width = "120dp" android: layout_height = "wrap_content" android: layout_x = "118dp" android: layout_y = "144dp" android: text = "item name: Ipad Air"/> <TextView android: id = "@ + id/TextView01" android: layout_width = "120dp" android: layout_height = "wrap_content" android: layout_x = "118dp" android: layout_y = "206dp" android: text = "color: White"/> <TextView android: id = "@ + id/TextView01" android: layout_width = "120dp" android: layout_height = "wrap_content" android: layout_x = "118dp" android: layout_y = "176dp" android: text = "product price: $19"/> <TextView android: id = "@ + id/TextView02" android: layout_width = "match_parent" android: layout_height = "3dp" android: layout_x = "2dp" android: layout_y = "261dp" android: background = "# EEE8CD"/> </AbsoluteLayout>

Zookeeper


For: android: id = "@ + id/AbsoluteLayout01", what I learned when I learned linear layout?

This is the definition of a component id. the id of this component is defined as AbsoluteLayout01.
You can use findViewById (R. id. AbsoluteLayout01) in the code to obtain this component object.

In addition, we can see from your id that this component is a layout component of AbsoluteLayout.

How can applications developed with AbsoluteLayout layout adapt to various screens?

What can I do without overall amplification? As we have already done this, all the elements at that time were a bit like games, and they were not quite implemented with other la S.
 

Related Article

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.