橫豎屏切換不重繪的問題

不看API更新的壞處就是,人家明明都修改了,我卻無知了。html

 

 <activity
            android:name=".HomeActivity"
            android:configChanges="orientation|keyboardHidden" />

  

按以前的寫法,這樣應該足夠,按理不該該重繪,可事實證實,這是錯誤的。緣由以下:java

 

"screenSize" The current available screen size has changed. This represents a change in the currently available size, relative to the current aspect ratio, so will change when the user switches between landscape and portrait. However, if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).

Added in API level 13.android

 

http://developer.android.com/guide/topics/manifest/activity-element.html#configapp

 

google人家老早更新了,事實證實須要這麼寫:ide

 

        <activity
            android:name=".HomeActivity"
            android:configChanges="orientation|keyboardHidden|screenSize" />
相關文章
相關標籤/搜索