简体   繁体   English

纵向屏幕模式下三星手机的方向问题

[英]screen mode in portrait the orientation issue in samsung mobile

我正在开发自定义相机应用程序,我不得不将屏幕模式设置为人像模式,但是来到三星移动时出现屏幕问题的方向。在三星手机中使用人像模式设置应用程序该怎么办

Try the following: In your activity, 请尝试以下操作:在您的活动中,

   /** Forces the application to run in portrait mode */
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

In your manifest.xml 在你的manifest.xml中

  <activity
        android:name="yourActivityName"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:screenOrientation="portrait" >
  </activity>

Also, if your application runs on v2.2 or above you can rotate camera orientation to portrait using camera.setDisplayOrientation(90). 另外,如果您的应用程序在v2.2或更高版本上运行,则可以使用camera.setDisplayOrientation(90)将摄像头方向旋转为纵向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM