| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
An Android staggered grid view which supports multiple columns with rows of varying sizes.
The StaggeredGridView was developed due to requirements for the Etsy app not met by any existing Android libraries. Namely a stable implementation with the ability to have a different number of columns in landscape & portrait, to sync grid position across orientation changes and support for headers & footers.
The library was built for and tested on Android version 2.3.3(SDK 10) and above. It could be modified to support older versions if required.
The simplest way to use AndroidStaggeredGrid is to add the library as a gradle aar dependency to your build. See the CHANGELOG.md for the latest version number.
repositories {
mavenCentral()
}
dependencies {
compile 'com.etsy.android.grid:library:x.x.x' // see changelog
}
Alternatively import the /library project into your Android Studio project and add it as a dependency in your build.gradle.
The library is currently configured to be built via Gradle only. It has the following dependencies:
Still use Eclipse/building with Ant? You can still use AndroidStaggeredGrid, it's just a few extra steps (left up to the reader).
Please see the /sample app for a more detailed code example of how to use the library.
<com.etsy.android.grid.StaggeredGridView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:item_margin="8dp"
app:column_count="@integer/column_count" />ListAdapter adapter = ...;
StaggeredGridView gridView = (StaggeredGridView) findViewById(R.id.grid_view);
gridView.setAdapter(adapter);NOTE: As column widths change on orientation change, the grid view expects that all children maintain their own width to height ratio. To assist with this the project includes the DynamicHeightImageView as an example of a view that measures its height based on its width.
The StaggeredGridView does not support the following:
Copyright (c) 2013 Etsy Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| Back | FazBrowse Home | New Git URL |