简体   繁体   English

如何将背景添加到基本(EFL)小部件?

[英]How to add background to elementary(EFL) widget?

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... 在EFL基本文档中,我找到了elm_bg函数,但无法将其设置为其他基本容器的背景...

Use elm_table widget. 使用elm_table小部件。 By using table, you can pack multiple objects into the same position. 通过使用表格,可以将多个对象打包到同一位置。

  1. create elm_table. 创建elm_table。
  2. create elm_bg (you can set bg by color or a image. 创建elm_bg(您可以按颜色或图像设置bg。
  3. pack that bg into table with the same position of your container widget. 使用容器小部件的相同位置将bg打包到表中。

Thanks. 谢谢。

Also asked on tizen.org, this part is unclear apparently 在tizen.org上也被问到,这部分显然还不清楚

https://developer.tizen.org/ko/forums/native-application-development/how-change-button-background-color 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. 主题化是方法,在先前的URL上共享示例代码。

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM