Android GridView property set, androidgridview

Source: Internet
Author: User

Android GridView property set, androidgridview
Some special properties of the GridView:

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

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 add data dynamically, the list will automatically scroll down and the latest entries will be automatically rolled to the visible range.

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)


In Android, how does one automatically adapt to the number of adapters in each row of the GridView?

Android: numColumns is used to set the number of columns. You can set the number of columns to display by yourself. Of course, you can also set the number of columns dynamically based on the screen size and image size! If you do not set this parameter, gallery automatically adjusts the number of columns! I have not tried it!
 
How does android's gridview control its height?

1. To control the overall height of the widget, you can directly set layout_height through the layout, or assign a value to him dynamically, but I believe this is not what the landlord asked.
2. Control the height of each unit. Because the gridview does not directly set the cell height, while the gridview is dynamically generated based on the adapter, it is generally obtained in the getView method of the adapter (the height of the View returned by this method ), you can process it here.

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.