I have a simple gridview, its elements have different height, for example, a small element in the row and one is larger, the next Line aligns small element, and a part of the larger element is under the second row, how can I set the height of each row in the gridview? May be the height of the largest element in the row ??
My Gridview
& lt; Android: id = "@ + id / new_small_list" Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" Android: numColumns = "2" Android: VerticalSpacing = "3dp" android: horizontalspacing = "3dp" Android: stretchMode = "columnWidth" Android: gravity = "center" Android: cachecolorhint = "@ android: color / transparent" />
To set cell height when you type, in GridViewAdapter:
@ override public view getView (view the status of int, viewview, viewgroup parent) {if (convertView == null) {LayoutInflater cellLayout = (LayoutInflater) getSystemService (context.LAYOUT_INFLATER_SERVICE); Convertview = Cell Layout. Float (R. Lit. Gridcel_layout, Faucet); } TextView cell_title = (TextView) ConvertviewFind.gridview_cell_text; ImageView cell_icon = (ImageView) ConvertviewfindIDell_image (R.id.griview_cell_image); .... Just replace this line:
convertView = cellLayout.inflate (R.layout.gridcell_layout, null); With this:
convertView = cellLayout.inflate (R.layout.gridcell_layout, gridView, false); In this way, setting up parent reference in "Fulao", the width and height of the cell will be set! Here you can find why:
Comments
Post a Comment