imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_in));
In the above line when I am using R.anim. fade_in/fade_out/slide_in_left/slide_in_right my app is working correctly. But if I am using any other animation, then in my phone it displays an error stopped unexpectedly. When I checked the error in the LogCat, it displayed an Runtime exception: Unknown animation name: cycleInterpolator (for example). Why is开发者_如何学JAVA this happening
The above mentioned four animations are built in for android. So, we dont need to write any special code for them. In the other case, they are not built in. So, you create a new folder in the res and name in anim. In the res/anim folder create a new xml file and write the animations for it using the tags
translate, scale, rotate, alpha, set
you can find the animations tutorial in this book: Android User Interface Development by Jason Morris
精彩评论