mohitum007 mohitum007 - 1 month ago 20
Android Question

Android GridView Odd item placement

I have a Gridview with odd number of items with two columns. The items are placed as:

Item 1 - Item 2

Item 3 - Item 4

Item 5 - Item 6

Item 7


i want the last Item 7 should be in center like this:

Item 1 - Item 2

Item 3 - Item 4

Item 5 - Item 6

Item 7


please help me , how to do this through Java code?

Answer

You can't get this with default gridView.

There is work around you can use:

  1. Try three column and make middle one invisible

    OR

  2. Add a separate view below of the grid view.

    OR

  3. Create your own gridview implementation

I think these work for you.