Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

如何切换程序UI方向为横屏或竖屏

From Wiki
Jump to: navigation, search
Article Metadata

文章
huwell 在 07 Jul 2007 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 设备, 软件 版本:

S60 3rd Edition

S60 3rd Edition, FP1


  • 详细描述:

缺省情况下,程序是根据手机屏幕的当前方向开始启动的。如果要强制程序以横屏或竖屏的模式启动,那我们在CAknAppUi::ConstructL()方法中调用BaseConstructL()时就要传递相应的flag值:

void CMyAppUi::ConstructL()
{
BaseConstructL( EAknEnableSkin | EAppOrientationLandscape ); // start in landscape mode
...
}


如果要在程序运行期间改变方向,则需要调用:

void CAknAppUiBase::SetOrientationL( TAppUiOrientation aOrientation );


这里的参数为EAppUiOrientationLandscape和EAppUiOrientationPortrait,注意这种情况下的调用就不要再向BaseConstructL()中传递相同的参数了。


注意

  • 横屏(landscape),前者是横幅,一般多用在风景照,所以叫"landscape"。
  • 竖屏(portrait),后者是直幅,一般多用在肖像上,所以叫"portrait"。
This page was last modified on 15 December 2011, at 10:03.
82 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×