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