Using TextView and TextEdit

Source: Internet
Author: User

1.TextView

Setting the layout file in Res/layout

Hint property: Prompt for input information
Text property: The difference from hint---hint is just a hint;
Text is the actual content
Introducing the layout XML file into the activity
Setcontentview (r.layout.main_activity); Associate a layout file with the current file
Wrap_content: Wrapping the actual text content
Fill_parent: The current control is covered with a parent container (before 2.3)
Match_parent: The current control fills the parent container (a property added after this 2.3api is currently used

2.ImageView

1. What is ImageView:
is a control that displays a picture
2.ImageView Properties:
android:src= content image for "@drawable/ic_launcher"--imageview
android:background= "@drawable/ic_launcher"---imageview background image
Android:background= "#00ff00"----RGB color of ImageView

3, android:orientation vertical placement;
4. The difference between the SRC attribute and the background attribute in ImageView:
SRC dimensions do not change with the size of the control, just refer to the picture
The size of the background is always the same as the size of the control, like a fill effect, filling the picture with controls
SRC and background can coexist in the same control

2.BUtton Click event

Both 1.Button and ImageButton have a Onclik event that adds a click event through their own. Setonclicklistener (Onclicklistener) method.
2. All controls have an OnClick event, not just button and ImageButton have
3. Click on the event of the listener can achieve the Click button after the action of what to happen

Several ways to listen for event implementations:
1. Implementation of anonymous inner classes
2. Implementation of independent classes
3. Implement the interface way to achieve

Using TextView and TextEdit

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.