18

So like most we have all used/seen the Google Plus App.

What interests me is the ColumnGridView they have developed, which not only does variable width, but variable height, seems that based on content will happily show the best space for the CardView.

Few possible solutions to replicate this, but only really looking for the best one which is of course the google implementation.

  1. Yes this can be achieved with a TableView - But that would be poor programming without a view recycler.
  2. My own custom implementation, based of a ListView/GridView - Not impossible but a lot of work.
  3. Ideally use the Google one which I am assuming is the same one for Google Now/Plus as they perform the same way based on the "Card" style items.

So has anyone come across this?

Any tutorials, examples, source I can use start with to save me some head way?

Maybe even some direction from the Google guys at how it is calculating the sizing?

Google Plus

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
Chris.Jenkins
  • 13,051
  • 4
  • 60
  • 61
  • I'm fairly certain this used to be either in the SDK or the support library. I remember seeing commits about its addition and then removal. Will have to search... – Jake Wharton Nov 18 '12 at 01:42
  • @JakeWharton, but the GridView class does not support variable width columns, right? They most likely hacked up their own specialized View for this. – LuxuryMode Nov 18 '12 at 02:01
  • That's why I said 'used to be'. As I said, it was added and then removed from the public API. I'll grep logs when I get a chance. – Jake Wharton Nov 18 '12 at 10:49

1 Answers1

20

StaggeredGridView currently exist in the frameworks/ex/widgets/ folder of AOSP which appears to be what Google+ is using (or a variant of it, likely).

It was going to be in the latest support library release (r11) until it was reverted by Katherine Kuan in b54e36f2 and moved to the experimental repo.

Jake Wharton
  • 75,598
  • 23
  • 223
  • 230
  • 1
    Made a Demo based off the of the view here: https://github.com/chrisjenx/StaggeredGridView – Chris.Jenkins Nov 18 '12 at 18:39
  • 3
    I would like to add that I took the StaggeredGridView and added a few missing features (OnItemClickListener, OnItemLongClickListener, Selector, Correct Position restore). u can check it out here https://github.com/maurycyw/StaggeredGridView – Maurycy Dec 13 '12 at 01:08
  • There is also https://github.com/felipecsl/AsymmetricGridView I haven't tested any of this libs yet. If someone has experiences with them I would be lucky to hear about them. – Janusz Jun 05 '14 at 08:23
  • i tried github.com/felipecsl/AsymmetricGridView. it was impossible to implement. – Bubunyo Nyavor Oct 12 '14 at 22:19