在4.0.3 Samsung Galaxy S2上发布Android Coverflow问题

Bal*_*yto 6 android coverflow

我正在使用android coverflow,它在大多数设备上运行良好,但似乎在Android 4.0.3中,一旦你来回滑动它就不会将中心图像放回到中心.

它们仍然"卡住"并处于错误的角度.

有没有人有类似的问题?什么可能导致这种行为?

因此,附加图像上的中间图像应居中,而不是按原样成角度.

CowerFlow问题

小智 17

我刚才补充道

child.invalidate() 
Run Code Online (Sandbox Code Playgroud)

之前

final int childCenter = getCenterOfView(child); in getChildStaticTransformation(View child, Transformation t) 
Run Code Online (Sandbox Code Playgroud)

所以它变成了

protected boolean getChildStaticTransformation(View child, Transformation t) {

    child.invalidate();
    final int childCenter = getCenterOfView(child);
    final int childWidth = child.getWidth();
    int rotationAngle = 0;
Run Code Online (Sandbox Code Playgroud)


小智 3

您在使用 Neil Davies Coverflow Widget V2 吗?

如果是的话,我就发现了问题所在。如果没有,很抱歉,我帮不了你。

问题出在函数 getCenterOfView 中。更准确的说,是view.getLeft()的问题。<--请告诉我是否有人知道为什么4.0之后有所不同

view.getLeft() 返回的值每次都不同。所以这会影响另一个函数getChildStaticTransformation,它找不到哪个imageview是中心。

我的解决方案是一个肮脏的修复,是给它一个范围来检测它的中心。

if (childCenter <= mCoveflowCenter + 125
            && childCenter >= mCoveflowCenter - 125) {
        transformImageBitmap((ImageView) child, t, 0);
}
Run Code Online (Sandbox Code Playgroud)

如果有人对此有更好的解决方案,请告诉我。