を明らかにする:遅れ円は私がボタンを押したときに、私はこのアニメーションを使用していますアニメーション
void circleAnimationEnter(final View view, final View view2) {
// get the center for the clipping circle
int cx = Math.round(view2.getX() + view2.getWidth()/2);
int cy = Math.round(view2.getY() - view2.getHeight()/2);
// get the final radius for the clipping circle
int finalRadius = Math.max(view.getWidth(), view.getHeight());
// create the animator for this view (the start radius is zero)
Animator anim;
Animation animation;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);
// make the view visible and start the animation
view.setVisibility(View.VISIBLE);
anim.setDuration(1000);
anim.setInterpolator(new AccelerateInterpolator());
anim.start();
} else {
view.setVisibility(View.VISIBLE);
view.animate()
.translationX(0)
.setDuration(500)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
}
});
}
}
View1をは/ショーを隠すための図であり、VIEW2は押しボタンです。
同じアニメーション(いくつかの変更はあまりありません)は、同じボタンを押して再び表示を変更すると非表示になります。
問題は、最初にボタンを押したときにアニメーションが遅れている(ビューがサークルアニメーションで表示されています)が、次回はアニメーションでビューの視認性が変わります、表示して非表示にする)完全に。
CollapsingToolbarLayoutを使用していますが、これは問題になる可能性がありますか?
遅れていますか?またはAndroidが正しくXとYを取得していないとき初めてですか?
ご協力いただきありがとうございました。ご迷惑をおかけして申し訳ありません。
EDIT:
問題は、CXとCYの値を得ることについてです。
Display display = getActivity().getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
// get the center for the clipping circle
cx = Math.round(width-width*10/100);
cy = Math.round(height-height*38/100);
initialRadius = Math.max(width*3/2, height*3/2);
finalRadius = initialRadius;
私のアニメーションはもう遅れが、問題はツールバーが折りたたままたは拡張された私は、画面サイズを取得していますので...(私は、このことを理解していない場合はCXとCYが変化しているということですされていませんので、私のCXとCYは私が解決
あなたは、 'cx'は' CollapsingToolbarLayout'の状態(展開/折りたたみ)によって異なると主張していますか? – azizbekian
@azizbekian私の答えをチェック! – Dahnark