问题
I want background color(or image) to elementary widget(also container) like grid or box.
how can I set background color to elementary widget?
in EFL elementary document, I found elm_bg functions, but I can't set it as background to other elementary containers...
回答1:
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:
Use elm_table widget. By using table, you can pack multiple objects into the same position.
- create elm_table.
- create elm_bg (you can set bg by color or a image.
- pack that bg into table with the same position of your container widget.
Thanks.
回答3:
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);
来源:https://stackoverflow.com/questions/24730499/how-to-add-background-to-elementaryefl-widget