언어 설정

Menu
Sites
Language
I'd like to make a genlist with backgroud image...
Hello, Dear. In my phone, the genlist by native has a white backgroud as default. But, I'd like to make a genlist on cute image. Can I make it ? List item's total count is 3. If I can do, I guess the frame will display cute image on bottom area. Of course, on top area , list item will be. Please let me know. Thanks

Responses

3 댓글
colin Rao

Hi,

try the elm_bg_add() and related api. I don't try such case for genlist, but I've a success case on box container, paste the sample code here as your refrernce. :)

Evas_Object *main_box = elm_box_add(ad->conform);
evas_object_size_hint_weight_set(main_box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(main_box, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(main_box);

/* Creating a background */
Evas_Object *bg = elm_bg_add(main_box);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);

/* Use red color for background */
//elm_bg_color_set(bg, 0xFF, 0x00, 0x00);
/* Set a file on the disk as background image */
elm_bg_file_set(bg, "/opt/usr/apps/org.tizen.test/res/images/mango.jpg", NULL);
/* Set an edje group as background image */
//elm_bg_file_set(bg, "/path/to/the/edje", "edje_group");
elm_bg_option_set(bg, ELM_BG_OPTION_STRETCH);
evas_object_show(bg);

/* Title Label*/
Evas_Object *label = elm_label_add(main_box);
elm_object_text_set(label, "Title Label");
evas_object_show(label);
elm_object_part_content_set(bg, "overlay", label);
elm_box_pack_end(main_box, bg);

 

Palitsyna

Hello,

try to use elm_bg_file_set() method. It sets the file (image or edje collection) to give life for the background. More information about this you can find here:

https://developer.tizen.org/dev-guide/2.3.0/org.tizen.native.mobile.apireference/group__Bg.html#ga621b8c0af0faa3abe3832304e880874e

 

Regards,

Svetlana Palitsyna

Kim

I tried this , already.

The below is mine.

Please check it.

But, I can't see the bg image due to genlist.

If I remove the code for genlist, I can see the bg image well.

 

Can you know the strange point on code ?

Please let me know.

Thanks.

 

 grid = elm_grid_add(nf);
 evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
 elm_win_resize_object_add(nf, grid);
 evas_object_show(grid);
 

 Evas_Object *bgImg = elm_bg_add(grid);
 char buf[PATH_MAX];
 
 elm_bg_option_set(bgImg, ELM_BG_OPTION_STRETCH);
 app_get_resource("images/health.png", buf, (int)PATH_MAX);
 elm_bg_file_set(bgImg, buf, NULL);

 evas_object_show(bgImg);
 elm_grid_pack(grid, bgImg, 0, 0, screen_width, screen_height);


 /* List */ 
 genlist = elm_genlist_add(bgImg);
 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);

 elm_genlist_item_append(genlist, &itc_gender, view_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, view_data);
 view_data->height_item =
  elm_genlist_item_append(genlist, &itc_height, view_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, view_data);
 view_data->weight_item =
  elm_genlist_item_append(genlist, &itc_weight, view_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, view_data);


 evas_object_smart_callback_add(genlist, "selected", genlist_selected_cb, view_data);
 
 evas_object_show(genlist);
 elm_object_part_content_set(bgImg, "overlay", genlist);
 elm_grid_pack(grid, genlist, 0, 0, screen_width, screen_height);