Learn android from scratch (ImageView and ImageButton usage .. 10 .)

Source: Internet
Author: User

The main function of the ImageView component is to provide a container for image display. The android. widget. ImageView class is defined as follows: java. lang. Object? Android. view. View? Android. widget. ImageView
Common Methods

No. Configuration property name Method Description
1 Android: maxHeight Public void setMaxHeight (int maxHeight) Define the maximum Image Height
2 Android: maxWidth Public void setMaxWidth (int maxWidth) Defines the maximum width of an image.
3 Android: src Public void setImageResource (int resId) Define the ID of the displayed Image
Of course, there are many ways to set images in imageview. You can check the image in future development.
.................................................................. Beautiful cut line .................................................................. Select the drawable-hdip folder under res to put the prepared image
Then define the xml file
     
  
 

Running effect:
.................................................................. Beautiful cut line .................................................................. ImageButton and imageView are similar, except that ImageButton has an event listening mechanism, which is similar to some other operations and Button components. In Android, an image Button is provided, you can directly use ImageButton to define the class as follows: java. lang. object? Android. view. View? Android. widget. ImageView? Android. widget. ImageButton
     
  
 


Is the Display Effect of imageButton.
This section is relatively simple. You can refer to the APi for more methods. Next forecast: Time selector: TimePicker

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.