setRequestedOrientation設置屏幕方向


void android.app.Activity.setRequestedOrientation(int requestedOrientation)
 
官方API解釋:
    Change the desired orientation of this activity. If the activity is currently in the foreground or otherwise impacting the screen orientation, the screen will immediately be changed (possibly causing the activity to be restarted). Otherwise, this will be used the next time the activity is visible.
 
中文大意:
    改變activity的期望的方向。如果activity 目前在前台或以其他方式影響屏幕的方向,屏幕將立即被改變(可能導致活動重新啟動)。否則,這將在activity 下一次可見時使用。
 

//設橫屏
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM