• 用代码旋转屏幕


    代码
     1 btnRotate.setOnClickListener(new OnClickListener() {
     2             @Override
     3             public void onClick(View v) {
     4                 int r = Math.abs(getRequestedOrientation());
     5                 Log.d("DEBUG",Integer.toString(r));
     6                 Log.d("DEBUG","LANDSCAPE =" + Integer.toString(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE));
     7                 Log.d("DEBUG","PORTRAIT  =" + Integer.toString(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT));
     8                 if (r == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
     9                     Log.d("DEBUG""To " + Integer.toString(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT));
    10                     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    11                 } else if (r == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
    12                     Log.d("DEBUG""To " + Integer.toString(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE));
    13                     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    14                 }
    15             }
    16         });
  • 相关阅读:
    HDU_2010——水仙花数
    HDU_2000——ASCII码排序sort()
    HDU_2008——数值统计
    HDU_2005——今天是今年的第几天
    HDU_2004——成绩转换
    HDU_2002——计算求的体积
    InnoDB可重复读隔离级别的底层实现原理
    nginx s reload原理
    Redis主从复制原理总结
    HTTP1.0、HTTP1.1 和 HTTP2.0 的区别
  • 原文地址:https://www.cnblogs.com/mobile/p/1910824.html
Copyright © 2020-2023  润新知