自定义Onlayout无法正常工作

时间:2013-09-28 07:54:22

标签: android viewgroup

任何人都可以告诉我如何在onLayout()中动态更改数据。我想显示前8个值,并在旋转后完成另外8个值,直到它显示数组限制。这是我的代码 -

if (position < conversion.length) {

                if (!childRotate) {
                    child.setAngle(angle);
                    child.setPosition(i);
                    position = i;
                    child.setImageResource(conversion[position]);
                    Float an = angle;
                    Log.i("prj,=angle", an.toString() + ",i=" + i.toString()
                            + ",onlayout,position=" + position.toString());
                    position++;

                } else {

                    child.setAngle(angle);
                    child.setPosition(i);
                    child.setImageResource(conversion[position]);
                    Float an = angle;
                    Log.i("prj,angle=", an.toString() + ",i=" + i.toString()
                            + ",onlayout,position=" + position.toString());
                    position++;
                    // childRotate = false;

                }
            }
            left = Math
                    .round((float) (((layoutWidth / 2) - childWidth / 2) + radius
                            * Math.cos(Math.toRadians(angle))));
            top = Math
                    .round((float) (((layoutHeight / 2) - childHeight / 2) + radius
                            * Math.sin(Math.toRadians(angle))));

            child.layout(left, top, left + childWidth, top + childHeight);
            angle += angleDelay;

0 个答案:

没有答案