Skip to content

A backwards compatible implementation of GridLayout for Android

License

Notifications You must be signed in to change notification settings

sgdesmet/android-gridlayout

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GridLayout Library

This library provides a version of GridLayout that works across all versions of Android 1.5+. As a side effect, this library also includes the lightweight Space as well.

For an introduction to GridLayout/Space, check out the Android Developers Blog post about the benefits and usage of GridLayout and Space.

Compilation

Compiling this library requires that the build SDK version be set to 3.0 or above. (It uses some more modern methods if they are available.)

Usage

This is a copy of the GridLayout from Android, so its usage is very similar. The only difference is that some attributes you will need to use your project's namespace instead of the android namespace:

<com.gridlayout.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:gridlayout="http://schemas.android.com/apk/res/com.mycompany.myapp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    gridlayout:alignmentMode="alignBounds"
    gridlayout:columnCount="4"
    gridlayout:columnOrderPreserved="false"
    gridlayout:useDefaultMargins="true" >

Caveats

Due to the inability to detect changes in child visibility in older versions of ViewGroup, it is necessary to call GridLayout.notifyChildVisibilityChanged() whenever you change the visibility of a child View of a GridLayout.

If you never change the visibility of children, you don't have to worry about this.

Maven

Possible usage: add this project as a submodule to your project and add something like

<dependency>
	<groupId>android.gridlayout</groupId>
	<artifactId>library</artifactId>
    <version>GIT-SNAPSHOT</version>
    <type>apklib</type>
    <scope>compile</scope>
</dependency>

to your pom.xml file. Note that the android maven plugin must be at least version 3.3.0 to support apklibs.

Support Library

Currently, including GridLayout from the android compatibility library in a maven project seems not possible. This provides a possible alternative.

About

A backwards compatible implementation of GridLayout for Android

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%