Android Learning notes (ii)

Source: Internet
Author: User

Following the video itself successfully created the HelloWorld project, after the completion of a few questions.

The first problem is that obviously created a project, but the result appeared two, thinking that the environment has a problem on the APPCOMPAT_V7 this project deleted, immediately the problem came, our HelloWorld project began to error. Appcompat_v7 There is a sense of existence.

First solve the project APPCOMPAT_V7 project error after completion. The HelloWorld item has a red warning issue.

Click "Project" on the menu bar, select "Clean", then "OK", and when clean is complete, you will find the APPCOMPAT_V7 package error. The problem with the red warning in the test package has been resolved, except that the test package has a yellow warning, just because the import class in Test's Java file is not being used, so it is completely out of control.

If it does not work, then right-click Appcompat_v7 package, select Properties, click "Android", if the library under the "Is Library" box is not checked, tick, click "OK", then follow the above steps to perform "clean" Operation.

Ask excessive Niang after understand, use a new version of ADT only then will appear this kind of situation. Appcompat_v7 is Google's own compatibility package, is a support library, allowing more than 2.1 full use of the 4.0 version of the interface. The support library is not required to select the Minimum SDK directly above Android4.0 when creating the project.

The second problem is that obviously the grammar is correct, but the compilation is not passed. My workaround is to refresh the project. If not, then cut the code, compiled through after pasting back. A good egg hurts.

The third problem is the layout configuration file. After the project is created, Fragment_main.xml and activity_main.xml two files are generated under the layout package, and the former is used by default.

A closer look reveals that the two root nodes are not the same, relativelayout and Framelayout respectively. So again turn to Niang.

Android five major layouts: Framelayout (frame layout), LinearLayout (linear layout), Absolutelayout (absolute layout), relativelayout (relative layout), Tablelayout (tabular layout).

Framelayout: Everything in turn is placed in the upper left corner, will overlap, this layout is relatively simple, but also can only put a little more simple things.

LinearLayout: Each of the linearlayout can be divided into vertical layouts (android:orientation= "vertical") and horizontal layouts (android:orientation= "horizontal"). When vertical layout, there is only one element for each row, and multiple elements are descending vertically; when horizontal layout, there is only a row, and each element is arranged to the right.

Absolutelayout: Absolute layout with x, y coordinates to specify the position of the element, this layout is also relatively simple, but in the screen rotation, often problems, and multiple elements of the time, the calculation is more troublesome.

Relativelayout: The relative layout can be understood as the layout of an element as a reference object to be positioned. The main attributes are: relative to an element Android:layout_below, Android:layout_toleftof relative to the parent element Android:layout_alignparentleft, Android: Layout_alignparentrigh.

Tablelayout: Each tablelayout has a table row tablerow,tablerow inside it can define each element in detail.

The video I'm looking for is so lazy, it doesn't say anything. Ay o (︶^︶) o

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.