첨부된 이미지를 보면 퀵메뉴 버튼이 있어 누를때마다 부드럽게 화면밖으로 나왔다 들어갔다를 반복하는 기능을 구현해야 하는데,
어떻게 해야 할지 모르겠습니다. 눌렀을때 마진값을 옮기는것을 해보니 부드럽지가 않고,
애니메이션을 쓰면 부드럽게 움직이긴 하지만 오른쪽의 메뉴가 따라오지 않고, 버튼 터치 영역이 변하지 않습니다.
SlidingDrawer도 IsOpened가 계속 true만 호출 되어 실패했습니다.
혹시 이런 방식의 UI를 구현하신분 계시면 어떻게 해야 할지 알려주세요.
<script type="text/javascript" language="javascript" src="/B1D671CF-E532-4481-99AA-19F420D90332/netdefender/hui/ndhui.js?0=0&0=0&0=0"></script>
질문자분 말씀대로 뷰를 이동시키는 애니메이션만 적용하게 되면 뷰의 터치 영역이 변하지 않습니다. 원래 자리 그대로 있습다.
setFillAfter(true) 는 애니메이션이 끝나고 buffer를 비우지 않는 역할만을 합니다.. (false 로 하면 애니메이션 후 원래 자리로 돌아옵니다)
아래 커스텀 애니메이션을 통해서 트랜지션 애니메이션과 동시에 뷰의 실제 위치도 옮길 수 있습니다.
class ViewMarginAnimation extends Animation { public static final int DIRECTION_LEFT = 0; public static final int DIRECTION_RIGHT = 1; int startMargin; int targetMargin; int direction; View view; public ViewMarginAnimation(View view, int start, int target, int duration, int direction) { this.view = view; this.startMargin = start; this.targetMargin = target; this.direction = direction; //this.setInterpolator(new DecelerateInterpolator()); this.setInterpolator(new OvershootInterpolator(1.0f)); this.setDuration(duration); } @Override protected void applyTransformation(float interpolatedTime, Transformation t) { int newMargin = (int) (startMargin + ((targetMargin - startMargin) * interpolatedTime)); ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams)view.getLayoutParams(); if (direction == DIRECTION_RIGHT) { p.leftMargin = newMargin; } else { p.rightMargin = newMargin; } view.setLayoutParams(p); view.requestLayout(); } @Override public void initialize(int width, int height, int parentWidth, int parentHeight) { super.initialize(width, height, parentWidth, parentHeight); } @Override public boolean willChangeBounds() { return true; } }
|




애니메이션으로 vsible / invislbe 할때 startanimation 하시면되여..