How to make Android GridLayout compatible to older version?

安稳与你 提交于 2019-11-27 01:03:09

问题


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


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/9126780/how-to-make-android-gridlayout-compatible-to-older-version

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!