How to add background to elementary(EFL) widget?

牧云@^-^@ 提交于 2019-12-08 08:50:49

问题


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.

  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.




回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!