监听屏幕布局的变化
来源:互联网 发布:手机淘宝客户端 html5 编辑:程序博客网 时间:2024/05/01 00:04
CS001438
开发伙伴平台:
S60 3rd Edition, S60 5th Edition
详细描述
当屏幕的尺寸或方位发生变化时,系统就会产生布局和屏幕方位改变的事件。S60平台支持多个屏幕分辨率,这个事件可以通过程序的CAknAppUi类或程序的CCoeControl控件处理。
源代码
解决方案1:
派生自CCoeControl的控件可以通过重载CCoeControl::HandleResourceChange()方法来获取布局的改变通知:
void CExampleControl::HandleResourceChange(TInt aType)
{
// Call base class implementation
CCoeControl::HandleResourceChange(aType);
if ( aType==KEikDynamicLayoutVariantSwitch )
{
TRect rect;
// Ask where container's rectangle should be
// EMainPane equals to area returned by
// CEikAppUi::ClientRect()
AknLayoutUtils::LayoutMetricsRect(
AknLayoutUtils::EMainPane,rect);
// Set new screen rect
SetRect(rect);
}
}
解决方案2:
从CAknAppUi派生的Application UI类可以重载CEikAppUi::HandleResourceChangeL()方法,以便获得KEikDynamicLayoutVariantSwitch的布局改变通知
void CExampleAppUi::HandleResourceChangeL(TInt aType)
{
// Call base class implementation
CAknAppUi::HandleResourceChangeL( aType );
if ( aType == KEikDynamicLayoutVariantSwitch )
{
TRect rect;
// Ask where container's rectangle should be
// EMainPane equals to area returned by
// CEikAppUi::ClientRect()
AknLayoutUtils::LayoutMetricsRect(
AknLayoutUtils::EMainPane,rect);
// Set new screen rect
// Must not call this if the iExampleControlContainer
// component is on the control stack
iExampleControlContainer->SetRect(rect);
}
// Must not call this if the iSomeDialog
// component is on the control stack
//iSomeDialog->HandleResourceChangeL( aType );
}
相关资料
TSS001178 - Switching orientation in dialog-based applications
- 监听屏幕布局的变化
- 监听EditText的变化
- 监听EditText的变化
- 监听EditText的变化
- 监听EditText的变化
- 监听EditText的变化
- 监听网络的变化
- 监听EditText的变化
- 在Android中处理屏幕布局变化
- 屏幕状态的监听
- 监听EditText的变化--TextWatcher
- Android监听网络的变化
- Android监听网络的变化
- android 监听电池电量的变化
- 监听SharedPreference变化的方法
- Android监听网络的变化
- Android 监听网络的变化
- android 监听EditText 的变化
- 习题9.20
- CreateIoCompletionPort()详解
- .net开源cms系统汇总(1)
- 2010.5.3去天池山烧烤了
- 习题9.26
- 监听屏幕布局的变化
- jquery.ajax GET 传递参数 乱码问题
- asp.net 中的 URL重写
- 【小阅读^大脑袋】0324 NO.342
- [转】学习jsp心得
- Linux文件类型及如何查看,修改文件读写权限
- 牛顿迭代法快速寻找平方根
- ubuntu下安装迅雷crossover-pro-7.1.0.sh+Thunder.cxarchiv
- 51单片机 Keil C 延时程序的简单研究