WEB开发网
开发学院手机开发Android 开发 Android 用程序改变屏幕垂直或水平 阅读

Android 用程序改变屏幕垂直或水平

 2010-05-31 14:44:00 来源:WEB开发网   
核心提示:android.view.IWindowManager windowService = android.view.IWindowManager.Stub.asInterface(android.os.ServiceManager.getService(”window”));try{if (windowService.g

android.view.IWindowManager windowService = android.view.IWindowManager.Stub.asInterface(android.os.ServiceManager.getService(”window”));

try

{

if (windowService.getOrientation() == 0) //Orientation vertical

{

windowService.setOrientation(1); //Orientation horizontal

Log.i(”info”, “orientation 1 “+windowService.getOrientation());

}

else

{

Log.i(”info”, “orientation 0 “+windowService.getOrientation());

}

}

catch (DeadObjectException e)

{

e.printStackTrace();

}

Tags:Android 程序 改变

编辑录入:coldstar [复制链接] [打 印]
赞助商链接