这个Demo演示了手机屏幕旋转时的动画效果,基本思路就是通过设置Window的属性,实现屏幕旋转时的动画效果, 但要求必须是Api18以上。
在这个小Demo上还出了一点小状况,程序运行时一直看不到效果,开始怀疑是不是自己对rotationAnimation 理解错了?查了一天的资料也没找到问题所在(不过还是有所收获的,呵呵),一天都比较郁闷。
后来才注意到, 当我旋转模拟器的屏幕时,屏幕的状态居然没有调整,于是在oncreate()方法里加了一了syso语句来监听 果然当屏幕旋转时居然没有重新调用oncreate()方法。
我用的是Api19的模拟器。不知道是模拟器有bug还是什么 原因,有知道的大神请帮忙解答下。不知道大家是否也遇到过这种情况。
后来换了一个Api18的模拟器,问题解决,运行正常。
布局文件activity .xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/info"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/cb_fullScren"
android:layout_marginTop=