当前位置:编程学习 > wap >>

关于强制横屏的问题

我在程序中某处主动调用以下代码
Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_EAST);//横屏
Ui.getUiEngine().relayout();
然后在screen里的sublayout()会被执行一次,但是在sublayout里调用Display.getOrientation()得到的还是之前的竖屏方向,而且宽高也没有发生改变.
我想请教下大家有没有人做过类似的需求? --------------------编程问答-------------------- setAcceptableDirections函数的说明写的很清楚啦, 看看就知道了.

Invoking this method with a direction parameter different from the current device direction does not automatically change the screen direction. The screen direction only changes once the device is rotated to a direction supported by the provided direction parameter. 

等你把手机横放的时候, sublayout执行时,Display.getOrientation()才是正确的值, 你那个sublayout()执行一次, 是因为你主动relayout的 --------------------编程问答-------------------- 目前我手边没有支持转屏的设备.不过我在9550的模拟器上发现这样的情况.首先我调用Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_EAST);//横屏
然后一段时间我操作模拟器就自动黑屏,这时我再操作点一下模拟器就会自动调用sublayout,并且此时宽高是正确的,屏幕也进行了横屏翻转.我也没有修改模拟器的Tilt Blackberry,debug看到是从main方法里的enterEventDispatcher()开始的.
所以我想知道能否在代码里做一次类似这样的调用 --------------------编程问答-------------------- 然后一段时间我不做任何操作模拟器就自动黑屏
补充:移动开发 ,  BlackBerry
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,