Sets the split line between listview items. The listview drag turns black.

Source: Internet
Author: User

1. Cancel the split line between items in listview:
(1) code method
Mlistview. setdivider (null );
(2) If you want to expand the distance between each item of the listview and make the split line disappear, you can set it like this.
Mlistview. setdividerheight (10 );
(3) XML
Android: divider = "@ null"

Android: dividerheight = "1dp"

(4) set the split line to its desired color.

Android: divider = "@ color/White"

 

2. Cancel the split line between the header and the bottom of the listview:


The listview split line is printed at the bottom of the header, data item, and root.
(1) code method
Set the period method first
Addheaderview (headview, null, true );
Addfooterview (footview, null, true );
Note: The third parameter must be true; otherwise, the parameter is invalid.

// Display the split line in the header
Listview. setheaderdividersenabled (true );
// Disable Split lines at the bottom
Listview. setfooterdividersenabled (false );

(2) XML

Android: headerdividersenabled = "true"
Android: footerdividersenabled = "true"

 

3. When adding a background for the program, it is found that it is dark when you drag the list or grid list.

Listview and gridview both have this attribute. The two settings are as follows:

(1) In the XML layout file, set it:
Android: cachecolorhint = "#00000000"

(2) set the Java code:
Listview. setcachecolorhint (0 );
Or
Gridview. setcachecolorhint (0 );  

 

 

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.