Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 359
mohitum Avatar asked Sep 13 '26 07:09

mohitum


1 Answers

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.

like image 146
Deepak Sachdeva Avatar answered Sep 14 '26 19:09

Deepak Sachdeva