|
这段代码去掉演示如何创建和使用一个简单的列表小部件。
- //create a box for your list object
- 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 list object
- Evas_Object *list = elm_list_add(ad->win);
- evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(box, list);
- for (int i = 0; i < 10; i++)
- elm_list_item_append(list, "item", NULL, NULL, NULL, NULL);
- //enable multiple selections
- elm_list_multi_select_set(list, EINA_TRUE);
- // enable scroller bouncing
- elm_scroller_bounce_set(list, EINA_TRUE, EINA_TRUE);
- //set scroller policy (here, vertical scroller will always be visible, horizontal will be shown when needed
- elm_scroller_policy_set(list, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_ON);
- //uncomment this for a horizontal list
- //elm_list_horizontal_set(li, EINA_TRUE);
- evas_object_show(list);
- elm_list_go(list);
复制代码
|
|