本文介绍了Tizen Mobile 2.3 WebViewer 示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有用于在您的应用中实现 webview 的 tizen 2.3 示例项目.官方 sdk 的示例中没有.
Is there any example projects for tizen 2.3 for implementing webview in your app. This is not in the samples with official sdk.
推荐答案
这里有一个例子,你可以参考
Here is an example that you can refer
#include <stdio.h>
#include <stdlib.h>
#include <EWebKit2.h>
#include <Eina.h>
#include <Ecore.h>
#include <Ecore_Evas.h>
#define W_WIDTH (480)
#define W_HEIGHT (800)
#define W_TEXTAREA_X (0)
#define W_TEXTAREA_Y (416)
#define W_TEXTAREA_WIDTH (W_WIDTH)
#define W_TEXTAREA_HEIGHT (64)
#define W_MAP_ORIGINE_X (0)
#define W_MAP_ORIGINE_Y (480)
#define W_MAP_HEIGHT (480)
static Ecore_Evas *window;
static Evas *e_webview;
static Evas *e_rect;
static Evas_Object *browser;
static Evas_Object *text;
static const char *default_url = "http://www.paytm.com";
int main(int argc, char *argv[]) {
int x = 0, y = 0, width = 0, height = 0;
char buf[256];
memset(buf, '\0', sizeof(buf));
ecore_evas_init();
window = ecore_evas_new(NULL, 0, 0, W_WIDTH, W_HEIGHT, "frame=0");
if(!window)
{
printf("ecore_evas_new error\n");
return 0;
}
// get screen size
ecore_evas_screen_geometry_get(window, &x, &y, &width, &height);
// Don't comment elm_init, SIGSEGV is occurred.
elm_init(argc, argv);
ecore_evas_size_min_set(window, 480, 800);
ecore_evas_size_max_set(window, width, height);
ecore_evas_show(window);
// test rectangle
e_rect = ecore_evas_get(window);
text = evas_object_text_add(e_rect);
evas_object_color_set(text, 256, 256, 0, 255);
evas_object_move(text, W_TEXTAREA_X, W_TEXTAREA_Y);
evas_object_resize(text, W_TEXTAREA_WIDTH, W_TEXTAREA_HEIGHT);
evas_object_text_font_set(text, "Sans", 24);
evas_object_show(text);
evas_object_layer_set(text, 30);
evas_object_text_text_set(text, buf);
// test map
e_webview = ecore_evas_get(window);
browser = ewk_view_add(e_webview);
evas_object_move(browser, W_MAP_ORIGINE_X, W_MAP_ORIGINE_Y);
evas_object_resize(browser, W_WIDTH, W_MAP_HEIGHT);
evas_object_show(browser);
ewk_view_uri_set(browser, default_url);
evas_object_layer_set(browser, 30);
ecore_main_loop_begin();
ecore_evas_free(window);
ecore_evas_shutdown();
return 0;
}
此示例是此处显示的示例的修改版本https://bugs.tizen.org/jira/secure/attachment/11555/Sample.c
This example is modified version of the sample present here https://bugs.tizen.org/jira/secure/attachment/11555/Sample.c
这篇关于Tizen Mobile 2.3 WebViewer 示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!