Android study note 01

Source: Internet
Author: User

1. I have watched some Android development over the past few days and used eclipseCodeFor some minor issues, please note here.

Set the shortcut key (-> window-> preferences-> General-> keys-> after searching, press the shortcut key you want to set in binding)

In view of the fact that I learned Android by watching videos, I wrote down some of the problems I encountered during my learning and learned together.

2. When you are writing and inputting the box code, follow the code in the video as follows:

This text field does not specify an inputtype or a hint

1 <Edittext2Android: ID= "@ + ID/factorone"3 Android: layout_width= "Fill_parent"4 Android: layout_height= "Wrap_content"/>

This is because the inputtype is not set. If it is not set, R. Java cannot be dynamically updated and errors may occur.

My solution is to add Android: inputtype = "text" to remove the warning.

 

3. An error message similar to button cannot be resolved to a type will also be prompted during code writing.

In fact, whether it is button or textview, it is because the import package needs to be introduced. In this case, you only need to press the shortcut key Ctrl + shit + O import package to solve the problem.

4. But the introduction of the package is not fixed. For example, I write a listener as follows:

1 ClassCalculatelistener implements onclicklistener {2 3 @ Override4Public VoidOnclick (view v ){5//Todo auto-generated method stub67 }89}

If I didn't follow the shortcut key to introduce onclicklistener,

1 Import Android. View. view;2Import Android. View. View. onclicklistener;

The result of the rewrite is:

However, if onclicklistener is introduced first, The onclick rewrite function is available.

5. There is a question about my compiler, that is, the text displayed in eclipse is too small, but there is no big difference in English,

How can I modify only the Chinese font size?

-> Window-> preferences-> General-> appearance-> Colors and fonts-> text font

Edit ------- set the original consolas to Courier New (of course, the premise is that the font status in your system is displayed; otherwise, you need to set the shadow to display)

6. When the first activity is displayed at the beginning, this code is first displayed because it is found in manifest. xml.

1   <  Intent-Filter  >  2                   <  Action  Android: Name  = "Android. Intent. Action. Main"   />  3   4                   <  Category  Android: Name  = "Android. Intent. Category. launcher"  />  5               </  Intent-Filter  >  

However, if there are multiple projects, there will be some problems, but if you comment out this sentence in the XML file that is not compiled first, the content of the current project can be displayed smoothly.

In addition, if a project contains multiple activities, you should also type the following code in the XML file:

1<Activity2Android: Name= ". Resultactivity"3 Android: Label= "@ String/result" >45</Activity>

 

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.