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 );