Skip to content Skip to sidebar Skip to footer

Android Gallery Bad Image Overlapping In CoverFlow

I'm tinkering with CoverFlow from here to match my preferences and can't fix one problem. Here's the screenshot: screenshot Pictures on the right from center image are overlapping

Solution 1:

You have specify the correct order by overriding getChildDrawingOrder function of Gallery class. Above behavior can be achieved by following piece of code:

int lastPosition;

@Override
protected int getChildDrawingOrder(int childCount, int i) {

    if (i == 0)
        lastPosition = 0;

    int centerPosition = getSelectedItemPosition()
            - getFirstVisiblePosition();

    if (i == childCount - 1) {
        return centerPosition;
    } else if (i >= centerPosition) {
        lastPosition++;
        return childCount - lastPosition;
    } else {
        return i;
    }
}

Solution 2:

mCamera.translate(xTranslate, 0.0f, translateDepth);

In the Coverflow class use the above function to increase the depth (More positive = More smaller) or translate in X direction. Also you can use some scaling. Use the centerOffset value as well. Serves the purpose.


Post a Comment for "Android Gallery Bad Image Overlapping In CoverFlow"