How to add background to elementary EFL widget?

1.7k Views Asked by At

I want the background color (or image) of elementary widget (also container) like a grid or box.

How can I set background color of the elementary widget?

In the EFL elementary documentation, I found elm_bg functions, but I can't set it as background to other elementary containers...

3

There are 3 best solutions below

0
RzR On BEST ANSWER

Also asked on tizen.org, this part is unclear apparently

https://developer.tizen.org/ko/forums/native-application-development/how-change-button-background-color

Theming is the way to go, sample code shared at previous URL.

2
SeoZ On

Use elm_table widget. By using table, you can pack multiple objects into the same position.

  1. create elm_table.
  2. create elm_bg (you can set bg by color or a image.
  3. pack that bg into table with the same position of your container widget.

Thanks.

0
Wycliffe Wasonga On
Evas_Object *bg = elm_bg_add(parent);

// Set a color
elm_bg_color_set(bg, 64, 127, 256);

// Set a background image
elm_bg_file_set(bg, "/path/to/the/image", NULL);

// Create your grid or box component with the background as parent
Evas_object *box = elm_box_add(bg);

/* Load content at the topmost layer of the background */
/* Note that the background has a swallow part and there is where our box will go */
elm_object_content_set(bg, box);