旋转我的android手机时,是否可以只旋转屏幕上的某些视图?
问题描述:
当screenOrientation="portrait"
时,它看起来像:
当screenOrientation="landscape"
时,它看起来像:
您只能看到中心视图已旋转,其他视图未更改.
You can see only the center view has been rotated, others are not changed.
在Android中是否可能?如果可以,如何实现?
Is it possible in android, and how to implement it if yes?
答
请参阅: http: //developer.android.com/guide/practices/screens_support.html
关于方向的部分
例如:
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
res/layout-xlarge-port/my_layout.xml // layout for extra large in portrait orientation
或在代码中.填写代码以自行更改布局.
Or in code. Fill in the code for changing the layout yourself.
活动:
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
}
}
清单:
<activity android:name=".MyActivity"
android:configChanges="orientation"/>