java - Android GridView layout and optimization -


I have two questions, the first is that I am creating a group of gridview and gridview items are only an image view When I put the 500 * 1000 image in the item (I only have four items) it's like crazy, but if I put a lower race photo (100 * 200) then it works fine Android can not handle it? (I was watching recycling)

The second is that I want to do in your Gridwu items 125dp width am and if additional space 2 DP vertical and horizontal gap, I it spread Gridwu items wants, I'm using your XML to your grid view items in your code do:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; ImageView xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "wrap_content" Android: id = "@ + id / imageView_icon" Android: layout_height = "wrap_content" & gt; & Lt; / ImageView & gt;  

And my gridviv:

  Android: Android: Android: Android: Android: Android: Android: Android: Layout_Hefe = "wrap_content" Android: verticalSpacing = Android: layout_marginLeft = "5dp" Android: layout_marginRight = "5dp" Android: layout_marginTop = "5dp" Android: stretchMode = "columnWidth" Android: Scrollbar = "None" Android: columnWidth = "125 DP" Android: Horizontal Location = "2 dp" Android: numColumns = "auto_fit" & gt; & Lt; / GridView & gt;  

This is what I need:

want

And this is what is happening:

After

GridView's layout code is ok, change grid_item layout like this

  & lt;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: orientation = "vertical" & gt; & Lt; imageView android: id = "@ + id / imageView_icon" Android: Layout_width = "Match_parent" Android: Layout_height = "Match_parent" Android: contentDescription = "@ string / hello_world" Android: adjustViewBounds = "true" Android: ScaleType = "FitXY" Android: cropToPadding = "false" /> & Lt; / LinearLayout & gt;  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

asp.net mvc - How to attach sql database to a javascript graph -

c# - How to know the number of Threads created and limit the Tasks accordingly -