Fighting android canvas – Hexagonal imageview layout for Android

We made a simple design for one of our apps which included a hexagonal network of images which should contain profile pictures of the users who liked a certain app.

To achieve it after many research we found this:

Which is a google java engine for using hexagonal layout. There aren’t many alternatives and the ones we found like were suspected to have memory leaks. So using this hex engine we found that on OS versions prior Android 4.0 everything was fine. But on 4.0+ the canvas added additional padding at the bottom of the view. So it looked something like this:

We spent hours on this until we discovered the OS problem.. So as it says here there were some new things from version 14 and above in the canvas which you can check HERE.

To fix this issue we had to do the simplest thing – disable the hardware acceleration for the specific view.  You can check the ways to disable it HERE.

After disabling it everything is perfect! If anyone is interested the issue is HERE. Feel free to use the library. It’s great!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s