뷰의 속성에 애니메이션을 적용 할 수있는 방법이 있습니까? 현재 내가 알고있는 유일한 애니메이션은 전체보기에 애니메이션을 적용하는 것입니다. 애니메이션에 속성 (예 : layout_width)을 적용 할 수 있는지 궁금합니다.android animate 속성
1
A
답변
0
보기의 속성에만 애니메이션을 적용하려는 경우에도 여전히보기의 애니메이션으로 설정해야합니다.
<scale
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="1.0"
android:toXScale="0" />
이 애니메이션은보기의 너비를 변경합니다.
당신은 당신이보기의 특정 부분에 영향을주는 애니메이션을 편집 할 수 있습니다
yourView.setAnimation(AnimationUtils.loadAnimation(this, R.anim.animation_name));
3
하여 애니메이션을 설정할 수 있습니다. 예를 들어, ViewFlipper
이 세로로 뒤집어 져있는 것처럼 보이기를 원했기 때문에 아웃 애니메이션이 뷰의 y를 중간에서 0으로 축소시키고 애니메이션에서 y를 중간에서 y만큼 늘립니다. 그들이 어떻게 생겼는지 보여줍니다.
shrink_to_middle.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:interpolator="@android:anim/linear_interpolator"
android:fromXScale="1.0"
android:toXScale="1.0"
android:fromYScale="1.0"
android:toYScale="0.0"
android:fillAfter="false"
android:duration="200" />
<translate
android:fromYDelta="0"
android:toYDelta="50%"
android:duration="200"/>
</set>
grow_from_middle.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:interpolator="@android:anim/linear_interpolator"
android:fromXScale="1.0"
android:toXScale="1.0"
android:fromYScale="0.0"
android:toYScale="1.0"
android:fillAfter="false"
android:startOffset="200"
android:duration="200" />
<translate
android:fromYDelta="50%"
android:toYDelta="0"
android:startOffset="200"
android:duration="200"/>
</set>
관련 문제
- 1. Animate Canvas.Left 속성
- 2. animate 'insertBefore'jquery
- 3. Android 하드웨어 속성
- 4. Android XML 레이아웃 속성 android : layout_toLeftOf
- 5. hide() jquery animate 함수가 animate() 다음에 설정된 경우 작동하지 않습니까?
- 6. Jquery animate problem
- 7. WPF - Animate ListBox.ScrollViewer.HorizontalOffset?
- 8. jQuery animate bottom div
- 9. Jquery Animate DIV
- 10. jQuery - .animate() 문제 "stepping"
- 11. JQUERY animate Delay?
- 12. animate() & fadeTo() both synchronous
- 13. animate textarea 내용
- 14. 동시`.animate()`와`.effect()`
- 15. IE8 jquery animate issue
- 16. jquery animate running laggy
- 17. jquery animate flickering
- 18. Animate UITableViewCell의 imageView 삽입?
- 19. Jquery .Animate Width 문제
- 20. jquery의 .animate 프레임 세트
- 21. jquery animate images
- 22. jquery animate 이상하게 행동합니다.
- 23. Jquery background animate
- 24. Animate UITableView 변경
- 25. jquery animate question
- 26. jQuery animate() repeat 3x
- 27. jQuery animate help
- 28. JQuery animate div "zoom"
- 29. jquery의 CSS 및 animate()
- 30. IE8의 jQuery .animate 문제
네,하지만 문제는 이것이 전체보기를 확장한다는 것이다. 그래서보기에 1 딥 경계선이있는 배경이 있으면 (예를 들어) 애니메이션이 재생 될 때 테두리가 더 두꺼워집니다. 나는 속성에 애니메이션을 적용한 다음 xml drawable을 다시 그려서 테두리가 1 딥 상태를 유지하도록하고 싶습니다. – Ben
9- 패치를 배경에 드로어 블로 사용하고 테두리를 비 스트레칭 영역으로 정의하여 경계선을 고정 된 상태로 유지할 수 있습니다. – Mannaz
그 생각이 마음에 들지만 ... 이제 질문은, XML 드로어 블을 통해 9patch를 만드는 방법이 있습니까? :) – Ben