Android Gridview Layout

Asked

Viewed 945 times

0

How to place lines between cells in a gridview. So that it doesn’t look like the items are floating. Example as columns and rows of an excel and if it is possible to change the color of some cell in a specific way.

1 answer

1


The way I do this is very simple, I fill the background of Gridview with one color, the items with another color and add the spacing between items, and then you have a grid with limits, like table. You can then combine these options to create beautiful effects.

Code example SOEN:

GridView gv = findViewById(R.id.my_grid_view);
gv.setBackgroundColor(Color.WHITE);
gv.setVerticalSpacing(1);
gv.setHorizontalSpacing(1);
  • 1

    Very creative this solution, I was researching and the only way I found was to put edges on the items of GridView. I thought it was pretty cool. + 1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.