Android Coverflow issue on 4.0.3 Samsung Galaxy S2

前端 未结 3 447
别那么骄傲
别那么骄傲 2021-02-04 19:16

I\'m using android coverflow, and it works fine on most of devices, but it seems that in Android 4.0.3 it does not put the center image back to the center once that you slide ba

3条回答
  •  醉梦人生
    2021-02-04 19:36

    I resolved following this code

    private int offsetChildrenLeftAndRight() {
        int offset = 0;
        for (int i = getChildCount() - 1; i >= 0; i--) {
    
            getChildAt(i).offsetLeftAndRight(offset);
    
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN)
                getChildAt(i).invalidate();
        }
        return offset;
    }
    
    
    final int childCenter = getCenterOfView(child) + offsetChildrenLeftAndRight();
    

提交回复
热议问题