Android screenOrientation 螢幕方向的設定與控制,android擷取螢幕方向

來源:互聯網
上載者:User

Android screenOrientation 螢幕方向的設定與控制,android擷取螢幕方向


AndroidManifest.xml中Activity標籤中的設定值:

android:screenOrientation="landscape"為90度(橫屏)

android:screenOrientation="reverseLandscape"為270度(反向橫屏)

android:screenOrientation="sensorLandscape"為90度和270度根據G-sensor切換(橫屏切換)


android:screenOrientation="portrait"為0度(豎屏)

android:screenOrientation="reversePortrait"為180度(反向豎屏)

android:screenOrientation=“sensorPortrait”為0度和180度之間切換(豎屏切換)




android:screenOrientation="nosensor"

設定activity螢幕方向為不跟隨感應器nosensor時,無論系統是否設定為自動轉屏,activity頁面都不會轉屏。

 

android:screenOrientation="sensor"

    設定activity螢幕方向為跟隨感應器sensor時,無論系統是否設定為自動轉屏,activity頁面都會跟隨感應器而轉屏。

 

綜上所述,activity裡設定的screenOrientation將優先於系統的自動轉屏設定。


比較常用,希望對大家有協助!




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.