全屏
构造container时,将AppUi()->ApplicationRect()做为参数aRect传递进去。
然后在container构造函数中调用SetRect(aRect);这样即可全屏显示
然后在container构造函数中调用SetRect(aRect);这样即可全屏显示
隐藏状态栏
CEikStatusPane* statusPane = StatusPane();
statusPane->MakeVisible( EFalse );
statusPane->MakeVisible( EFalse );
旋转屏幕
2.8,3.0 SDK支持屏幕旋转,程序里面可以捕获该消息,然而使UI自定义的改变位置
继承的函数为:
Container::HandleResourceChange,原先的
SizeChange这个函数不会响应
在该函数内不要使用
AppUi->ClientRect函数来获取工作区范围,数据会有偏差(这个问题郁闷了好久),可以使用
TRect rect;
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,rect );
AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,rect );
来获取RECT
全屏到正常
User "SetRect" inside your container. Pass in the original client area rect parameter back to the CCoeControl.
You may use the following code:
1) Before calling "SetExtentToWholeScreen", save the rect:
iRect = Rect();
Gets the control's extent
2) call "SetExtentToWholeScreen"
3) Switch back:
SetRect( iRect );
You may use the following code:
1) Before calling "SetExtentToWholeScreen", save the rect:
iRect = Rect();
Gets the control's extent
2) call "SetExtentToWholeScreen"
3) Switch back:
SetRect( iRect );
获取当前旋转状态
#include <aknappui.h>
CCoeEnv* env = CCoeEnv:: Static ( );
if ( env )
{
CAknAppUiBase* appUiBase = REINTERPRET_CAST ( CAknAppUiBase*, env->AppUi ( ) );
if ( appUiBase )
{
/*
* Possible values for TAppUiOrientation are :
* EAppUiOrientationUnspecified,
* EAppUiOrientationPortrait,
* EAppUiOrientationLandscape,
* EAppUiOrientationAutomatic
**/
CAknAppUiBase:: TAppUiOrientation orientation = appUiBase->Orientation ( );
}
}
CCoeEnv* env = CCoeEnv:: Static ( );
if ( env )
{
CAknAppUiBase* appUiBase = REINTERPRET_CAST ( CAknAppUiBase*, env->AppUi ( ) );
if ( appUiBase )
{
/*
* Possible values for TAppUiOrientation are :
* EAppUiOrientationUnspecified,
* EAppUiOrientationPortrait,
* EAppUiOrientationLandscape,
* EAppUiOrientationAutomatic
**/
CAknAppUiBase:: TAppUiOrientation orientation = appUiBase->Orientation ( );
}
}