Android GridLayout V7 的支持

  • Android,google,gridlayout,

Android4.0增加了一个 GridLayout , 对于4.0之前的版本,如果要使用 GridLayout ,可以使用 google 提供的 , 这是一个项目,在你的 sdk 目录下 sdk_folder\extras\android\compatibility\v7\gridlayout

Library Project including GridLayout.

This can be used by an Android project to provide access to GridLayout on applications running on API 7+ . 按我的理解,这个可以被当成一个Android project使用,用来为API 7 以上的版本提供GridLayout的支持。

There is technically no source, but the src folder is necessary to ensure that the build system works. The content is actually located in libs/android-support-v7-gridlayout.jar . 项目的src目录是空的,但是是必须的,不然会运行不起来。真正的代码被放在了libs下的jar包里了。


Make sure you use in your layouts instead of \<gridlayout>. Same for \<> instead of \<space>. \<>而不是\<gridlayout>。

Additionally, all of GridLayout's attributes should be put in the namespace of the app, as those attributes have been redefined in the library so that it can run on older platforms that don't offer those attributes in their namespace. 要注意命名空间的问题。例子里有,注意看readme.txt

To know which attributes need the application namespace, look at the two declare-styleable declared in res/values/attrs.xml 哪些参数可以使用,参考res/values/attrs.xml


# Project target.

然后再你想使用GridLayout的项目里,引入这个项目作为库。 具体步骤参考 有图有真相有英文。


- EOF -