找回密码
 立即注册
查看: 2607|回复: 0

Tizen基本照片小部件

[复制链接]
发表于 2015-9-11 23:48:32 | 显示全部楼层 |阅读模式
这段代码演示了如何使用基本的照片部件。这个小工具的目的是展现人的照片。当没有图像加载它显示一个占位符。
  1. // create box for our photo objects
  2. Evas_Object *box = elm_box_add(ad->win);
  3. evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  4. elm_win_resize_object_add(ad->win, box);
  5. evas_object_show(box);

  6. // create the first photo
  7. Evas_Object* photo = elm_photo_add(ad->win);
  8. evas_object_size_hint_weight_set(photo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  9. evas_object_size_hint_align_set(photo, EVAS_HINT_FILL, EVAS_HINT_FILL);

  10. // set  photo file (PHOTO_DIR should look like this "/opt/usr/apps/org.tizen.myproject/res/images")
  11. char file[PATH_MAX];
  12. snprintf(file, sizeof(file), "%s/image.png", PHOTO_DIR);
  13. elm_photo_file_set(photo, file);

  14. evas_object_show(photo);
  15. elm_box_pack_end(box, photo);

  16. // create another photo without sending an actual image file - placeholder is shown
  17. Evas_Object* empty_photo = elm_photo_add(ad->win);
  18. evas_object_size_hint_weight_set(empty_photo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  19. evas_object_size_hint_align_set(empty_photo, EVAS_HINT_FILL, EVAS_HINT_FILL);
  20. evas_object_show(empty_photo);
  21. elm_box_pack_end(box, empty_photo);
复制代码
欢迎来到泰泽网:http://www.tizennet.com/ 泰泽论坛:http://bbs.tizennet.com/ 好没有内涵哦,快到设置中更改这个无聊的签名吧!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|泰泽应用|泰泽论坛|泰泽网|小黑屋|Archiver|手机版|泰泽邮箱|泰泽网 ( 蜀ICP备13024062号-1 )

GMT+8, 2024-12-26 01:30 , Processed in 0.054023 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表