Skip to main content

Posts

Showing posts from January, 2013

Custom XML Attributes in Libraries

Today I added a custom attribute to StickyGridHeaders to set whether headers are sticky or not. In order to use XML attributes from third party libraries in Android you need to add the a namespace URI to your XML layout. xmlns:app="http://schemas.android.com/apk/res-auto" The choice of what to call the namespace is up to you, just as long as it is not android. Anyway, the layout file for using StickyGridHeaders in the example is now. <?xml version="1.0" encoding="utf-8"?> <com.tonicartos.widget.stickygridheaders.StickyGridHeadersGridView xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/asset_grid"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:clipToPadding="false"     android:padding="...

Introducing Sticky Grid Headers

Recently, I came across a library by  +Emil Sjölander called StickyListHeaders . It is an implementation of an Android list view with integrated section headers that conveniently stick to the top of the view while part of the section is still displayed. The library is also very easy to use and as such has gained a lot of popularity. Unfortunately, for a project I am currently working on I needed such a thing with multiple columns. Android provides a grid view which satisfies the multiple columns problem, but like the standard list view, it doesn't support section headers. So, inspired by Emil's approach, I've written StickyGridHeaders .