14

New GridLayout for Android 4 is good. Both in terms of code maintainability and performance.

I wanted help with backward compatibility for GridLayout for older version. Waiting for official compatibile package is taking too long. I know its possible and someone did mention that this could be done by copying the class from version 4 platform source.

Would be really great if anybody could guide me how to do this.

For reference please check this post on Google Plus https://plus.google.com/105051985738280261832/posts/KbqAxUQTzVf

Siddharth Menon
  • 587
  • 1
  • 8
  • 21

2 Answers2

30

A better way of doing this is using Android Support Library. Since resource files are also involved it cannot be included as .jar library.

Update the android SDK and support files.

  1. Add your-android-sdk\extras\android\support\v7\gridlayout project to eclipse.
  2. Make the project as library.
  3. Add this library project to your working project.

To use gridlayout in XML use it like this

<android.support.v7.widget.GridLayout> </android.support.v7.widget.GridLayout>

Hope that was helpful.

Siddharth Menon
  • 587
  • 1
  • 8
  • 21
  • 6
    Also make sure you set up your namespace: http://stackoverflow.com/a/10687429/15882 – Jarett Millard Apr 16 '13 at 14:07
  • How do I do the step `#2` ? I'm having a problem, eclipse does not recognize the `gridlayout` ? It says "Wrong namespace... should use `app:*`" – mr5 May 15 '14 at 02:56
  • @mr5 just follow the official documentation : https://developer.android.com/tools/support-library/setup.html#libs-with-res – faizal Aug 28 '14 at 03:15
5

Check out this project: https://github.com/dlew/android-gridlayout

ramdroid
  • 6,738
  • 1
  • 16
  • 14