Add icon into Box container, but cant see in UI

Add icon into Box container, but cant see in UI

BY 21 Jan 2015 Native Application Development

Hi, All

Please help to check my code. Seems it’s not working, the icon image cant show on the UI.

Evas_Object*
create_aboutme_view(Evas_Object *parent)
{
    Evas_Object *sub_view, *box1, *box2, *box3;

	sub_view = elm_box_add(parent);
	evas_object_size_hint_weight_set(sub_view, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(sub_view, EVAS_HINT_FILL, EVAS_HINT_FILL);

	box1 = elm_box_add(sub_view);
	elm_box_horizontal_set(box1, EINA_TRUE);
	elm_box_padding_set(box1, 16, 16);

	char filename[PATH_MAX];
    Evas_Object *ic = elm_icon_add(box1);
    snprintf(filename, sizeof(filename), "%s%s", ICON_DIR, "head_man72.png");
    elm_image_file_set(ic, filename, NULL);
    evas_object_size_hint_min_set(ic, 72, 72);
    evas_object_show(ic);
    elm_box_pack_start(box1, ic);

    evas_object_show(box1);
    elm_box_pack_end(sub_view, box1);

	box2 = elm_box_add(sub_view);
	evas_object_show(box2);
	elm_box_pack_end(sub_view, box2);

	box3 = elm_box_add(sub_view);
	evas_object_show(box3);
	elm_box_pack_end(sub_view, box3);

	evas_object_show(sub_view);

	return sub_view;
}

static void
tabbar_item_cb(void *data, Evas_Object *obj, void *event_info)
{
    appdata_s *ad = data;
	Elm_Object_Item *it;
	Evas_Object *sub_view;
	Eina_Bool b;
	const char *str = NULL;

	it = event_info;

	str = elm_object_item_text_get(it);

	if (str && !strcmp(str, "Message")) {
		//...
	}
	else if (str && !strcmp(str, "Friends")) {
		//...
	}
	else {
		sub_view = create_aboutme_view(ad->nf);
	}

	elm_object_content_set(ad->nf, sub_view);
}

 

Written by