Click the notation in the event XML

Source: Internet
Author: User

For the control Click event, I usually prefer to use the setonclicklistener in the activity, but this code is large, and it does not conform to the logic of code writing, the better way is to use the XML file android:onclick= "" and android:clickable= "true" to implement, for ImageView and TextView, the default android:clickable= "false" (that is, do not respond to clicks), so it needs to be set to "true" line, The button and ImageButton default to "true". In addition, with two answers about the Click event, very up posture, thank you crooked nut basin Friends AH ~ ~ ~
This is related to the theme, set Android:clickable to True response click
How can I give ImageView click Effect like a button in Android?

Click the notation in the event XML

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.