1 Library Project including GridLayout. 2 3 This can be used by an Android project to provide 4 access to GridLayout on applications running on API 7+ 5 6 There is technically no source, but the src folder is necessary 7 to ensure that the build system works. The content is actually 8 located in libs/android-support-v7-gridlayout.jar 9 10 11 USAGE: 12 13 Make sure you use <android.support.v7.widget.GridLayout> in your 14 layouts instead of <GridLayout>. 15 Same for <android.support.v7.widget.Space> instead of <Space>. 16 17 Additionally, all of GridLayout's attributes should be put in the 18 namespace of the app, as those attributes have been redefined in 19 the library so that it can run on older platforms that don't offer 20 those attributes in their namespace. 21 22 To know which attributes need the application namespace, look at 23 the two declare-styleable declared in res/values/attrs.xml 24 25 26 27 For instance: 28 29 <?xml version="1.0" encoding="utf-8"?> 30 <android.support.v7.widget.GridLayout 31 xmlns:android="http://schemas.android.com/apk/res/android" 32 xmlns:app="http://schemas.android.com/apk/res-auto" <==== the namespace used for the library project 33 android:layout_width="match_parent" 34 android:layout_height="match_parent" 35 app:columnCount="6" > <===== notice how we're using app:columnCount here, not android:columnCount! 36 37 <Button 38 android:id="@+id/button1" 39 app:layout_column="1" <=== again, note the app: namespace 40 app:layout_columnSpan="2" 41 app:layout_gravity="left" 42 app:layout_row="1" 43 android:text="Button" /> 44 45 <CheckBox 46 android:id="@+id/checkBox1" 47 app:layout_column="4" 48 app:layout_gravity="left" 49 app:layout_row="2" 50 android:text="CheckBox" /> 51 52 <Button 53 android:id="@+id/button2" 54 app:layout_column="5" 55 app:layout_gravity="left" 56 app:layout_row="3" 57 android:text="Button" /> 58 59 <android.support.v7.widget.Space <=== space widgets also need the full support package path 60 android:layout_width="21dp" <=== use the android namespace for width, height etc -- only use app: for the grid layout library's new resources 61 android:layout_height="1dp" 62 app:layout_column="0" 63 app:layout_gravity="fill_horizontal" 64 app:layout_row="0" /> 65 66