README.txt
1Library Project including compatibility GridLayout.
2
3This can be used by an Android project to provide
4access to GridLayout on applications running on API 7+.
5
6There is technically no source, but the src folder is necessary
7to ensure that the build system works. The content is actually
8located in libs/android-support-v7-gridlayout.jar.
9The accompanying resources must also be included in the application.
10
11
12USAGE:
13
14Make sure you use <android.support.v7.widget.GridLayout> in your
15layouts instead of <GridLayout>.
16Same for <android.support.v7.widget.Space> instead of <Space>.
17
18Additionally, all of GridLayout's attributes should be put in the
19namespace of the app, as those attributes have been redefined in
20the library so that it can run on older platforms that don't offer
21those attributes in their namespace.
22
23To know which attributes need the application namespace, look at
24the two declare-styleable declared in res/values/attrs.xml
25
26
27
28For 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.v7.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