Monday, July 18, 2011

Display images inside a GridView in Android using VS 2010

Introduction

The GridView view mode displays a list of data items by binding data fields to columns and by displaying a column header to identify the field. The column cells and the column header of a GridViewColumn have the same width. By default, each column sizes its width to fit its content. Optionally, you can set a column to a fixed width. Related data content displays in horizontal rows.

GridView in Android

GridView is a ViewGroup in ehich you can displays items in a two-dimensional and also scrollable grid. By using ListAdapter you can add items in the grid the items are automatically inserted to the layout. GridView is basically used to create more interactive app widgets on the users Home screen. You can use the GridView view together with ImageView views to display a series of images.

The table below shows the XML Attributes which you have to use while working with GridView XML file:
 

 

Attribute Name Related Method Description
android:columnWidth setColumnWidth(int) Used for width for each column.
android:gravity setGravity(int) Used for gravity within each cell.
android:horizontalSpacing setHorizontalSpacing(int) Used for default horizontal spacing between columns.
android:numColumns setNumColumns(int) Used for how many columns want to show.
android:stretchMode setStretchMode(int) Used for fill the available empty space.
android:verticalSpacing setVerticalSpacing(int) Used for default vertical spacing between rows.



Read more: C# Corner
QR: https://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://www.c-sharpcorner.com/UploadFile/manish1231/8288/

Posted via email from Jasper-Net