如何设置背景图片在Tizen本机应用程序 [英] How to set background image in Tizen native app

查看:181
本文介绍了如何设置背景图片在Tizen本机应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图设置在Tizen本机应用程序的背景图片,但都没有成功为止。
我曾试图通过Canvas和位图,但其不工作做同样的,虽然我没有得到任何错误。

I have been trying to set background image in Tizen Native app but have not been successful so far. I have tried doing the same through Canvas and Bitmap but its not working,though i am not getting any error.

我使用的是低于code在我的形式OnInitializing功能。

I am using the below code in the OnInitializing function of my form.

AppResource *pAppResource = Application::GetInstance()->GetAppResource(); 
Bitmap* pBitmap1 = pAppResource->GetBitmapN(L"image.png");   
Canvas *pCanvas = new Canvas();    
pCanvas->Construct();    
pCanvas->DrawBitmap(Point(0,0), *pBitmap1);   
pCanvas->Show();      

任何想法可能是什么问题,或者做同样的任何其他更简单的方法?

Any idea what could be the issue or any other simpler way of doing the same?

谢谢,

推荐答案

添加一个名为屏幕密度xhigh的资源文件夹和存储图像,你要设置为应用背景,这个文件夹的文件夹。现在宣布结果类型的onDraw()函数到应用程序header.Now执行code波纹管这种形式的.cpp文件。

Add a folder named "screen-density-xhigh" to the resource folder and store image to this folder that you want to set as application background. Now declare result type onDraw() function into the application header.Now implement the code bellow to the .cpp file of this form.

 result TizenForm::OnDraw()
  {

    result r = E_UNKNOWN;
    AppResource *pAppResource = Application::GetInstance()->GetAppResource();
    Bitmap* pBitmap1 = pAppResource->GetBitmapN(L"backgroundImage.jpg");
    Canvas* pCanvas = GetCanvasN();
    if (pCanvas != null)
    {
      pCanvas->DrawBitmap(Rectangle(0, 0,720,1280), *pBitmap1);
    }

    return r;

 }

这篇关于如何设置背景图片在Tizen本机应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆