Donnerstag, 20. September 2012

Changing the icon size in a DraggableGridView

I love DraggableGridView. It's easy to use and looks really nice. I use it in one of my apps, called the DSO-Timer.

But there is one small thing, that bothers me. I couldn't find a way to customize the size of the icons.

So I emailed Thomas Quinn and asked him. A few hours later I received his answer:
Easily done. Just change this section of code in onLayout(...):

        //determine number of columns, at least 2
        colCount = 2;
        int sub = 240;
        w -= 280;
        while (w > 0)
        {
                colCount++;
                w -= sub;
                sub += 40;
        }

To something way simpler, like this:

        //determine number of columns for 50dp children
        colCount = w / 50;

This is the code where the size of the icons is calculated. After playing a bit around in the code, I ended up with this:


Keine Kommentare:

Kommentar veröffentlichen