流星悟语 发表于 2015-9-11 23:48:32

Tizen基本照片小部件

这段代码演示了如何使用基本的照片部件。这个小工具的目的是展现人的照片。当没有图像加载它显示一个占位符。
// create box for our photo objects
Evas_Object *box = elm_box_add(ad->win);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(ad->win, box);
evas_object_show(box);

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

// setphoto file (PHOTO_DIR should look like this "/opt/usr/apps/org.tizen.myproject/res/images")
char file;
snprintf(file, sizeof(file), "%s/image.png", PHOTO_DIR);
elm_photo_file_set(photo, file);

evas_object_show(photo);
elm_box_pack_end(box, photo);

// create another photo without sending an actual image file - placeholder is shown
Evas_Object* empty_photo = elm_photo_add(ad->win);
evas_object_size_hint_weight_set(empty_photo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(empty_photo, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(empty_photo);
elm_box_pack_end(box, empty_photo);
页: [1]
查看完整版本: Tizen基本照片小部件