【发布时间】:2015-05-01 01:01:26
【问题描述】:
我希望我的布局动画并旋转 90 度(左/右),而不是为其横向模式创建新的 xml 布局。
【问题讨论】:
标签: android android-layout android-animation
我希望我的布局动画并旋转 90 度(左/右),而不是为其横向模式创建新的 xml 布局。
【问题讨论】:
标签: android android-layout android-animation
尝试将此代码添加到您的 onCreate() 方法中。我无法尝试,但这应该可以工作,因为它在更改方向时也会调用 oncreate 方法。
if(getResources().getConfiguration().orientation==Configuration.ORIENTATION_PORTRAIT){
//insert your code here when it is portrait
}
else if(getResources().getConfiguration().orientation==Configuration.ORIENTATION_LANDSCAPE){
//insert your code here when it is landscape
}
【讨论】: