[Lgame 012. Controls] simple controls are essentially an extremely powerful lpaper.

Source: Internet
Author: User

[Lg012. control] simple controls are similar to virtual but extremely powerful lpaper

Keyword: lgame entry control lpaper

What do you mean? Flowers? No, it's your heart ~

Reprinted please note, original address: http://blog.csdn.net/musicvs/article/details/7552524

LpaperIt is extremely simple to use, so I will not be too long-winded ~

Okay, I 'd like to say something:

LPaper paper = new LPaper(0, 0, 400, 400);

The first two parameters are coordinates, and the last two parameters are width and height.

-

LpAperWhat is it? It is a piece of paper with nothing left. Since it is a piece of paper, you can also set the background color or image.

-

ItsActually, I prefer to call it a virtual box.

Why? I believe everyone has done or understood web page programming, and is Div familiar?

Well, to take care of friends you have never been in touch with, just give a brief description. DIV is used to partition webpages, such as a simple layout:

A total of three regions, that is, three Divs, can be used to manage different areas of the webpage in different categories, which is very convenient. Well, I don't want to explain it much. After all, this is the lgame entry-level school, not the webpage programming entry-level school ~

-

WoodI have also written a simple div-like control myself. Now I have used a lot in my code, which is really convenient.

For example, if there are three button controls, the boss asks me to properly coordinate them as follows:

Ah, simple ~ Done ~

-

Bad ~!The boss suddenly said that the three controls would move 12 pixels to the right... Well, I moved them one by one and got it done again ~ Simple ~

Bad ~!The boss said, "Move back two pixels to the left... Okay, there are only three controls. I will move it again ~ Done again ~

Bad ~!What if there are 10 controls? Also one by one ?~ No, it's not a waste of time on repetitive and useless work for our code-based child ~

-

For exampleWhat if div is used?

Simple ~ Drop the three widgets into the div ~ What? Want to shift right? Well, the DIV is moved to the right, and the control inside is also moved ~

What? Want to move to the left? OK ~ Move the DIV to the left, and the three buttons are moved again ~

-

ItsActually, this example is unlikely to happen, because we are generally not so stupid. It is clear that the interval between the 10 buttons is the same, and we need to map coordinates one by one? A loop, everything is done ~ Is it ~? Hey hey ~

However, this example shows the benefits of Div. Div has many unexpected benefits and you can explore them slowly ~

-

InstituteIn fact, the lpaper of lgame is actually a div (or div-like). I use it as a div ~

What about you ?~

-

GoodIf you have never used Div, it doesn't matter. lpaper is a small desktop, and we also drop the control, which is managed by lpaper to hide lpaper, the controls in it cannot be displayed ~ Very convenient ~

 

 

PairHow can I throw the control into lpaper? In fact, it is very simple. Most of the lgame controls can be added to other controls. You only need to call the Add function of the control. Yes, the control also has the Add function:

LPicture picture = new LPicture(0, 0, 100, 100);LPaper  paper = new LPaper(0, 0, 400, 400);paper.setBackground(LColor.blue);paper.add(picture);add(paper);

 

See, paper. Add (picture); add an lpicture control to lpaper.

 

 

-

Okay ~ Thank you again for listening to me ~

The original Article was first published on the Android-fans Forum:

Http://www.android-fans.net/thread-1646-1-1.html

 

 

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.