スライド アニメーションの動作が少しイライラします。
動画を作ってyoutubeに投稿しました。ルート化されていない電話から画面ビデオを作成できるアプリが見つからなかったので、この方法で行う必要がありました:)
注: 00:07 から始まる最初のアニメーションをよく見てください。小さな閃光に気付くでしょう..これは初めてのことです。アニメーションをトリガーします...
その後、ビデオでアニメーションをさらに数回トリガーすると、フラッシュがなくなり、すべてがスムーズに実行されます。
私が使用するコードは次のとおりです。
private void slideDown(){
// Here I calculate the height of a header and the ListView (That is not populated in the video, therefore - white and empty), as it will be different for different screen sizes
float headerHeight = header.getHeight();
float topicNameHeight = topHeader.getHeight()+1;
float totalHeight = headerHeight+topicNameHeight;
float listSize = listView.getHeight();
int theSizeIWant = (int) (listSize+totalHeight);
//slide down
if (counter==0){
listView.setPivotY(0);
ObjectAnimator slideAnimation = ObjectAnimator.ofFloat(listView, "y",topicNameHeight);
ObjectAnimator rotateAnimation = ObjectAnimator.ofFloat(btn_slider, "rotation",0f,180f);
listView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, theSizeIWant));
rotateAnimation.setDuration(800);
slideAnimation.setDuration(800);
slideAnimation.start();
rotateAnimation.start();
counter=1;
}
//slide up
else{
ObjectAnimator slideAnimation = ObjectAnimator.ofFloat(listView, "y",totalHeight);
ObjectAnimator rotateAnimation = ObjectAnimator.ofFloat(btn_slider, "rotation",180f,360f);
listView.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int)listSize));
rotateAnimation.setDuration(800);
slideAnimation.setDuration(800);
slideAnimation.start();
rotateAnimation.start();
counter=0;
}
}
問題の原因は何ですか?
私はそれが小さなことであることを知っていますが、それは主にイライラしているので、修正する必要があります!