简体   繁体   English

如何在Tizen中调整图标大小(可穿戴)

[英]How to resize Icons in Tizen (Wearable)

I am trying to make a simple app for my Galaxy Watch which runs on Tizen. 我正在尝试为运行在Tizen上的Galaxy Watch制作一个简单的应用程序。 All I want to do for now is to display a white screen with two circular buttons on the top and bottom (plus and minus buttons). 我现在要做的就是显示一个白色屏幕,在顶部和底部带有两个圆形按钮(加号和减号按钮)。 I seem to have the white screen part settled. 我似乎已经解决了白色屏幕的问题。 But, when I try to display the icon, the icon fills the whole window. 但是,当我尝试显示图标时,该图标会填满整个窗口。 I need help, please. 我需要帮助。

(PS: I have some knowledge on Android app development. But, Tizen is a completely different ball game. I know C & C++ to a certain extent) (PS:我对Android应用程序开发有一些了解。但是,Tizen是完全不同的球类游戏。我在某种程度上了解C和C ++)

    Evas_Object *bg = elm_bg_add(ad->win);
    elm_bg_color_set(bg, 255, 233, 26);
    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(ad->win, bg);
    evas_object_show(bg);

    /* Plus Icon */
    Evas_Object *plusIcon = elm_icon_add(bg);
    elm_image_file_set(plusIcon, "/opt/usr/apps/org.example.basicui/res/images/plus.png", NULL);
    elm_object_content_set(bg, plusIcon);

The Tizen documentation is really confusing and lacklustre (unlike Android's). Tizen文档确实令人困惑和乏味(与Android不同)。 Also, I can't find any wholesome tutorial regarding Tizen Native Wearable App Development. 另外,我找不到关于Tizen Native Wearable App Development的任何有益的教程。 If you know of any such tutorial, please share it with me. 如果您知道任何此类教程,请与我分享。

Thanks again. 再次感谢。

"/opt/usr/apps/org.example.basicui/res/images/plus.png" “/opt/usr/apps/org.example.basicui/res/images/plus.png”

is there plus.png file in this path? 这个路径中有plus.png文件吗?

if(!elm_image_file_set(plusIcon,...
  elm_bg_color_set(bg, 255, 0, 0);

If there is no file, the background will be red. 如果没有文件,则背景为红色。

If you want to create a clickable widget, you can use elm_button. 如果要创建可单击的小部件,则可以使用elm_button。 Make the button's style "circle". 使按钮的样式为“圆形”。 Then create elm_image and set it to elm_object_content_set(). 然后创建elm_image并将其设置为elm_object_content_set()。 However, this style may vary depending on your tizen version. 但是,此样式可能会因您的tizen版本而异。

So I recommend the following way. 因此,我建议采用以下方式。

/*BG - box(container) - image(clicked event)
                        image(clicked event)*/


Evas_Object *bg, box, *image;
// Make BG
bg = elm_bg_add(parent); 
elm_bg_color_set(bg, 255, 233, 26);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);

// Make container
box = elm_box_add(bg);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(box);

// Make image
image = elm_image_add(box);
if(!elm_image_file_set(image, /* Image path*/, NULL))
  return;
evas_object_size_hint_min_set(image, 100, 100);  // minimum size
evas_object_show(image);
evas_object_smart_callback_add(image, "clicked",  /* event callback function */, NULL);
elm_box_pack_end(box, image);

image = elm_image_add(box);
if(!elm_image_file_set(image, /* Image path*/, NULL))
  return;
evas_object_size_hint_min_set(image, 100, 100); // minimum size
evas_object_smart_callback_add(image, "clicked", /* event callback function */, NULL);
evas_object_show(image);
elm_box_pack_end(box, image);

elm_object_content_set(bg, box);

elm_win_resize_object_add(ad->win, bg);

elm_box https://developer.tizen.org/ko/development/guides/native-application/user-interface/efl/building-ui-layouts/box elm_box https://developer.tizen.org/ko/development/guides/native-application/user-interface/efl/building-ui-layouts/box

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

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

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