简体   繁体   中英

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

  <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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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