Use of android GridView

Source: Internet
Author: User

Use of android GridView

Some attribute settings:

1. android: numColumns = "auto_fit"// Set the number of columns in the GridView to automatic

2. android: columnWidth = "90dp"// The width of each column, that is, the width of the Item

3. android: stretchMode = "columnWidth"// Scaling and small column Synchronization

4. android: verticalSpacing = "10dp"// Margin between two rows

5. android: horizontalSpacing = "10dp"// Margin between two columns

6. android: cacheColorHint = "#00000000"// Remove the default black background when dragging

7. android: listSelector = "#00000000"// Remove the selected yellow background color (if you want to customize the press effect, you can set it to a transparent color and set your own selector)

8. android: scrollbars = "none"// Hide the scroll bar of the GridView

9. android: fadeScrollbars = "true"// If it is set to true, the scroll bar can be automatically hidden and displayed.

10. android: fastScrollEnabled = "true"// The Quick scroll button appears in the GridView (at least four pages will be displayed)

11. android: fadingEdge = "none"// The Color of the fading edge of the GridView is null. The default value is vertical. (It can be understood as the color of the upper and lower edges)

12. android: fadingEdgeLength = "10dip"// Defines the length of the fading edge.

13. android: stackFromBottom = "true"// When it is set to true, the list you have prepared will display the bottom of your list

14. android: transcriptMode = "alwaysScroll"// When you dynamically add data, the list will automatically scroll down the latest entries to the visible range. (After the settings are found, you can always pull down, there is no data above. You can pull it again. It's a strange phenomenon !)

15. android: drawselectid Top = "false"// Click a record, and the color will become the background color after the record. The text of the content is visible (false by default)


Both the ListView and GridView controls can only use the selector to set the effect of the press, but the effect will not be maintained when the hands are relaxed. To maintain the effect, you can make a position mark at the press position, set the position value in the onItemClick event to notify the data to refresh. In getView, check whether it is the tag you set. If yes, set the selected effect, not all of the selected results are removed.




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.