Multiple Screens Support

This article gives some tips on how your application can support screen resolutions in Tizen Native API.

Before reading this article please familiarize with article about Responsive UI and with Enlightenment Foundation Libraries (EFL) which is used to create UI in Native API applications for Tizen.

You can find EFL documentation in SDK Help and  on webpage - http://docs.enlightenment.org/.

Introduction

The Tizen comes in a variety of screen sizes:

  • HD – 1280x720 pixels
  • WVGA – 800x480 pixels

As an application developer you should take care of how your application looks in different resolutions. A good user experience is important, I'm sure, you would like your application to be available on more than one screen resolution without having to rebuild it.

 

Multiple screens support

To create an application that supports multiple screen sizes, you can use 2 available methods:

  • set base scale in EDC file
  • set base scale in C file

Currently 2 base scales are supported:

  • 1.8 for WVGA
  • 2.4 for HD

 

EDC file

collections 
{
   base_scale: 2.4; // HD
   parts 
   {
      part 
      {
         name: "box"; 
         type: RECT;
         min: 100 100;
         scale: 1;
      }
   }
}

 

C file

Sometimes it is better for an application to specify base scale in C file. To do this you have to use elm_app_base_scale_set() function, e.g.

static bool
app_create(void *data)
{
   elm_app_base_scale_set(2.4); // HD
}

You can also define macro which will calculate required size for the appropriate scale, e.g.

#define ELM_SCALE_SIZE(x) (int) (x / elm_app_base_scale_get() * elm_config_scale_get())

And then you can use is it in your application code, e.g.

char txt[60];

snprintf(txt, sizeof(txt), "<font_size=%d>TITLE</font_size>", ELM_SCALE_SIZE(60));

elm_object_text_set(ad->labelTitle, txt);

 

 

Figure 1 Multiple screens support in portrait mode

 

Figure 2 Multiple screens support in landscape mode

 

Summary

We hope this article has shown you how to support multiple screen resolutions. Use this knowledge in your Tizen Native application for a better user experience and to make your application available on more than one screen resolution.

For better understanding of the code please check attached files of MultipleScreensSupport application.

File attachments: 
List
SDK Version Since: 
2.3.1