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