更改android中特定视图的屏幕方向

问题描述:

我的应用程序默认处于肖像模式。所以我宣布更改android中特定视图的屏幕方向

<activity 
      android:name=".phone.activities.BasePhoneActivity" 
      android:configChanges="orientation|screenSize" 
      android:logo="@drawable/home_icon" 
      android:screenOrientation="sensorPortrait" 
      android:theme="@style/ItemListTheme" 
      android:windowSoftInputMode="stateAlwaysHidden|adjustResize" /> 

在清单文件中。每截图

enter image description here

而且我的手机处于纵向模式。现在,我将手机旋转到左侧(90度),在横向模式下,我只想使用箭头图像更改该布局的方向。但是我已经在清单文件中给出了android:screenOrientation="sensorPortrait",在我的活动中我没有收到onConfigurationChanged(Configuration newConfig)事件,我无法更改该布局。

该视图不能被强制 - 或者我不知道如何。它可以是活动。

迫使整个活动景观例如可以在明显的做:

<activity android:name=".ActivtyName" 
     android:screenOrientation="landscape" 
       > 

强制视图:

  • 检测的情况下,需要旋转时。
  • onDraw()适用于90度的转换,您必须检测转换位置的尺寸