Android ApiDemos example resolution (172): Views-& gt; Lists-& gt; 5. Sep

Source: Internet
Author: User

Sometimes you need to display some separation lines in the list. This can be done by deriving BaseAdapter and reloading the areAllItemsEnabled and isEnabled methods.

Boolean isEnabled (int position)

If the return value is "true", it indicates that the location is not a separator. If the return value is "false", it indicates that the behavior separator line is used. The separator line does not support click events. In this example, the line starting with "-" is defined as a separator line:


[Java]
@ Override
Public boolean isEnabled (int position ){
Return! MStrings [position]. startsWith ("-");
}

@ Override
Public boolean isEnabled (int position ){
Return! MStrings [position]. startsWith ("-");
}

In addition, if the list contains delimiters, areAllItemsEnabled must return false.

 

[Java]
@ Override
Public boolean areAllItemsEnabled (){
Return false;
}

@ Override
Public boolean areAllItemsEnabled (){
Return false;
}


 

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.