Overview of the Android entry controls

Source: Internet
Author: User

Text:

TextView: Marquee Four lines of code, custom controls

EditText Special properties: Hint InputType

Autocompletetextview Special properties: Hint,completionthreshold requires an adapter layout file to choose Android. R.layout.simple_list_item1

Multiautocompletetextview Special properties: Completionthreshold requires an adapter

  

Image:

ImageView Special properties: Backgroud,src Backgroud can also set the background color

Button:

Button has the Text property Onclicklistener ()

ImageButton has the SRC attribute and the background attribute, without the Text property Onclicklistener ();

ToggleButton Special properties: Checked,texton,textoff requires a oncheckchangelistener ()

check box

CheckBox Special attribute: checked requires a oncheckchangelistener ()

Radiogroup,radiobutton Special Properties: orientation;checked multiple selection of one oncheckchangelistener ()

Event:

Onclicklistener (Listenner) Oncheckchangelistener (Listener)

Three ways to implement events:

1, Anonymous inner class

2, the way to implement the interface

3, external class (used when all buttons are required to implement the same function)

Adapter adapter:

Create adapter First

arrayadapter<string> adapter= New Arrayadapter<string> (this,//context, layout file, data source

Android. R.layout.simple_list_item_1, RES);

Autoc.setadapter (adapter); To bind a control to an adapter

Toast.maketext (mainactivity.this, "Anonymous inner Class", 1). Show ();

Here are the questions and workarounds:

1, the new Android project does not have a R.java file

Just tick in front of the build automatically option in Project dropdown.

2. Change the layout

Refator--android--changelayout

3, create a new activity and add it in Androidmanifest

4, Anonymous internal class context fill in: Activity name. This

Overview of the Android entry controls

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.