나는 onDraw를 구현하는 사용자 정의보기가 있으며 오른쪽 상단에 작은 오버레이 이미지와 배경을 성공적으로 그립니다. 나는이 같은 사용자 정의보기를 무효화하면 ...ScaleAnimation in custom 잘림보기
final AnimationSet animationSet = new AnimationSet(false);
animationSet.addAnimation(scaleAnimation);
animationSet.addAnimation(rotationAnimation);
animationSet.setFillAfter(true);
post(new Runnable() {
@Override
public void run() {
animationSet.start();
new Handler().post(getAnimationRunnable(animationSet));
}
private Runnable getAnimationRunnable (final AnimationSet animationSet) {
return new Runnable() {
@Override
public void run() {
final Transformation outTransformation = new Transformation();
if (animationSet.getTransformation(System.currentTimeMillis(), outTransformation)) {
// store matrix for applying in onDraw
mMatrix = outTransformation.getMatrix();
// THIS INVALIDATE DOESN'T WORK
parent.invalidate(new Rect(getParentInvalidateRect()));
post(getAnimationRunnable(animationSet));
}
}
};
}
});
// THIS INVALIDATE DOES WORK
invalidate(getOverlayClientRect());
는 애니메이션이 발생하고 모든입니다 : 내가 수동으로 수행하여 그 오버레이 이미지 (A ScaleAnimation 및 회전 애니메이션과 AnimationSet을) 애니메이션 애니메이션 이미지가 이제 잘리는 것을 제외하고는 위와 같았습니다.
그러나 사용자 정의보기의 오른쪽 위 영역과 교차하는 parent.invalidate()에 Rect를 전달하면 사용자 정의보기의 onDraw가 트리거되지 않습니다.
그래서 ...
- 것이다이 방법을 사용할 수 있습니까?
- 그렇다면 사용자 정의보기 onDraw 메서드를 호출할지 여부를 결정하는 parent.invalidate()에 전달 된 Rect 이외의 요소가 있습니까?
엄청난 양의 연구에 감사드립니다. 나는 여기에서 같은 문제를보고 있는데, 문제를 알 수있는 것에서는 크기 조정 된보기에서 Android가 다시 그려야하는 영역을 잘못 계산한다는 것입니다. Android는 이전 너비 및/또는 높이와 크기 조정 된 항목 사이의 모든 항목을 잘못 위아래로 잘라냅니다. clipChildren을 false로 설정하는 것은 권장하지 않는 방법입니다 (부작용이있는 것처럼 보았습니다). 다른 방법으로이 문제를 해결 한 경우, 현재 해결할 수 없다면 현재 해결 방법을 모르기 때문에 알려 주시기 바랍니다. –