How to control landscape and portrait programmatically in android?

前端 未结 5 892
慢半拍i
慢半拍i 2021-02-06 07:07

I developed on application using android sdk 4.0 and I install that .apk file in my samsung tab. When I run that application it is working properly. If I change the tab portra

5条回答
  •  情歌与酒
    2021-02-06 07:19

    If you search first, you'll find this question answered already. I'll post the answer again here though.

    Go to your manifest file, and under the activity that you want to keep portrait only, insert the following line
    android:screenOrientation="portrait" An example is given below.

    
    

    this will make your activity forced to be in portrait mode only, even if you hold the device in landscape mode.

提交回复
热议问题