在Android中仅更改某些子视图的方向

时间:2016-05-03 09:59:45

标签: android android-sensors android-orientation landscape-portrait textureview

我有一个Fragment,当我以这种方式调用onResume()时,我将纵向锁定为纵向:

if (screenOrientation == Configuration.ORIENTATION_PORTRAIT) {
     getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
      }

现在这个片段有一个视图 - 我们称之为fragmentView。此fragmentView由其他一些观点组成(例如ButtonsTextViewsTextureView等。

由于onResume()中的代码段会锁定方向,因此视图不会随设备的方向而改变。但是,我想要的是选择性地锁定方向;即,当方向发生变化时,我希望Buttons和其他一些Views相应地旋转,而TextureView保持静止。

我怎样才能做到这一点?

0 个答案:

没有答案