旋转我的android手机时,是否可以只旋转屏幕上的某些视图? [英] Is it possible to just rotate some views in screen when rotate my android phone?

查看:92
本文介绍了旋转我的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"/>

这篇关于旋转我的android手机时,是否可以只旋转屏幕上的某些视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆