简体   繁体   English

tizen本机按钮可以用透明颜色吗?

[英]tizen native button with transparent color possible?

I want to set an image on a button and set its background color to be transparent.我想在按钮上设置图像并将其背景颜色设置为透明。 We can show button with default color and set an icon on it, but when I set the colors alpha value to zero or less everything turns to be transparent.我们可以显示具有默认颜色的按钮并在其上设置一个图标,但是当我将 colors alpha 值设置为零或更少时,一切都变得透明了。 I need to show the image on the button at least.我至少需要在按钮上显示图像。

So how do I set transparent background with code?那么如何用代码设置透明背景呢?

other solutions all with EDC editor or EDC code, that is not supported on new Tizen 5.5.其他解决方案都带有 EDC 编辑器或 EDC 代码,新 Tizen 5.5 不支持。

code:代码:

Evas_Object *box = elm_box_add(ad->win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_content_set(ad->conform,box);
evas_object_show(box);

ad->button = elm_button_add(ad->conform);
evas_object_size_hint_weight_set(ad->button,0.0,1.0);
evas_object_size_hint_align_set(ad->button,-1.0,1.0);
elm_object_text_set(ad->button,"");
evas_object_color_set(ad->button, 255, 100, 100, 250); //any transparency?
evas_object_show(ad->button);
elm_box_pack_end(box,ad->button);

Evas_Object *ic;
ic = elm_icon_add(ad->button);
elm_image_file_set(ic,ICON_DIR"/ok.png",NULL);
elm_object_part_content_set(ad->button,"icon",ic);
evas_object_show(ic);

There is currently no API to change only the button background color.目前没有 API 仅更改按钮背景颜色。

If you use the click event with elm_image, I think you can create what you want.如果您将点击事件与 elm_image 一起使用,我认为您可以创建您想要的内容。

( https://developer.tizen.org/ko/development/guides/native-application/user-interface/efl/ui-components/wearable-ui-components/image ) https://developer.tizen.org/ko/development/guides/native-application/user-interface/efl/ui-components/wearable-ui-components/image

I hope this helps you.我希望这可以帮助你。

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

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