Android literacy 2

Source: Internet
Author: User

Http://35java.com/zhibo/forum.php? MoD = viewthread & tid = 388 & extra = Page % 3d1

InAndroidThe reference to resources in development is very important.AndroidThe good and bad engineering structure. In fact, we can see the relationship between the resource files of the engineering structure. I personally think that learning is good.AndroidResource files are a very important part. Here we talk about some basic-level knowledge points, so you can read them with patience.

1,
Three resource file formats. Mutual reference between resource files is naturally the foundation of the Three Forms(Android: xxx/YYY, @ xxxx/YYY ,? XXX)The difference must be thoroughly understood.

2,
The attribute name of the resource file. Resource file attribute name(In fact, most of them areIDName, there are others, it is no longer cumbersome here)It is a very important part for beginners. It is actually some pre-defined variables. can you ignore them? These variables will automatically generate ing classes?R. JavaTo generate some static index values.AndroidQuick positioning and naming are all in vain. We are also required to be well-known.(It is best to include the type).

3,
Each project has a correspondingAndroidmanifest. xmlFile. Note that some permissions indicate attributes, such:

<Uses-Permission Android: Name = "android. Permission. Internet"/>

<Uses-Permission Android: Name = "android. Permission. read_contacts"/>

<Uses-Permission Android: Name = "android. Permission. write_contacts"/>

<Uses-Permission Android: Name = "android. Permission. install_packages"/>

<Uses-Permission Android: Name = "android. Permission. delete_packages"/>

After reading the name, you will know what permission restrictions are imposed on. Therefore, Beginners should pay attention to the following:ProgramReport during runningSecurityexceptionCheck whether your program involves restricted operations. TheseAndroid. manifest. PermissionIn this example, you may think it will be better, and your learning ability is very important. Otherwise, what you do cannot be a frontier.

4,
Reference a custom class. For how to define and use it, referApidemoClassic instances:Com. example. Android. APIs. View. lableview. Java. This is also very heavy, because in our development process, AndroidProvidedUIIt cannot meet our requirements, so you have to write newUIClass, I encountered many such problems during development. For example,AndroidExistingTabhost, InTabspecWhen there are many times, you will feelTabhostThe hero is useless, so you have to write it yourself.

Write your ownAndroid Components

The fourth point above has mentioned the importance of learning to write your own controls. InAndroidIt provides a wide range of class libraries. It is worth exploring how to use them well. Of course, this is also true.APIAs mentioned in this article, I mainly talk about the important aspects in the course of learning..

The main interface layout class:LinearlayoutAndFramelayoutUnderstanding simple development is enough.ViewManagerAnd its subclass.

Where,LinearlayoutVertical and horizontal, they can be nested with each other. When nesting, pay attention to the attributes of height and width, such.

<Linearlayout xmlns: Android = "http://schemas.android.com/apk/res/android"

Xmlns: APP = "http://schemas.android.com/apk/res/com.srk.study"

Android: Id = "@ + ID/screen" Android: layout_width = "fill_parent"

Android: layout_height = "fill_parent"

Android: Background = "@ drawable/background" Android: focusable = "true"

Androidrientation = "vertical">

<Linearlayout
Android: layout_width = "fill_parent"

Android: layout_height = "65dip"

Android: Background = "@ drawable/background"

Androidrientation = "horizontal">

<Com. SRK. Study. model. titleview Android: Id = "@ + ID/titleview"

Android: layout_width = "280dip" Android: layout_height = "65dip"

Android: paddingleft = "5dip" Android: paddingtop = "10dip"

APP: focusbgcolor = @ drawable/whitecolor app: titlecolor = @ drawable/blackcolor

APP: titlesize = "15dip"/>

<Com. SRK. Study. model. connectview Android: Id = "@ + ID/connectview"

Android: layout_height = "65dip"

Android: layout_width = "40dip" app. startx = "280dip"/>

</Linearlayout>

<! -- ############ Body ############# -->

<Listview Android: Id = "@ + ID/bodylistview" Android: layout_width = "fill_parent"

Android: paddingtop = "3dip" Android: layout_height = "wrap_content"

Android: layout_weight = "1.0"

Android: persistentdrawingcache = "animation | scrolling"

Android: scrollbars = "vertical" Android: focusable = "true"

Android: scrollbarsize = "12dip"/>

</Linearlayout>

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.