判断当前屏幕的方向

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  int orientation = getResources().getConfiguration().orientation;
  if (orientation == Configuration.ORIENTATION_LANDSCAPE) {// 横屏
  } else if (orientation == Configuration.ORIENTATION_PORTRAIT) {// 竖屏
  }
}

 

posted @ 2013-11-29 14:00  zhangze  阅读(567)  评论(0编辑  收藏  举报