在本机Android应用程序中使用WebView整体布局是否有用? [英] Is it useful using WebView whole layout in native Android app?

查看:72
本文介绍了在本机Android应用程序中使用WebView整体布局是否有用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发本机android应用.我的应用程序有很多活动.我想开发native android应用.但是在某些情况下,我想使用webview,其中整个布局只是一个webview.不是线性或相对或其他布局,仅是Web视图. HTML中运行的所有图像和其他内容. All of screen will run in HTML5.

I am currently developing a native android app. My app has a lot of activities. I want to develop native android app. But in some case, I want to use a webview where the entire layout is just a webview. Not linear or relative or another layout, just a webview. All of the images and other things running in HTML. All of screen will run in HTML5.

因此,我可以将我的应用程序部分转移到iphone应用程序或其他平台上.这就是这种方式对我的好处.

So, I can partially transfer my app into iphone app or other platforms. This is the benefit of this way to me.

但我不知道.这样更好吗?表现如何?转换为HTML5应用有什么缺点?

But I don't know. Is this way better? What will the performance be? What is the disadvantages of converting to an HTML5 app?

你能解释吗?

推荐答案

有一个很好的演示文稿关于这个话题.

  1. 性能:您将在两者之间添加一个附加层,一个Webkit引擎无法始终匹配本机(有时是硬件加速)的渲染性能.

  1. Performance: You are adding an additional layer in between, A webkit engine cannot always match native (and sometimes hardware accelerated) rendering performance.

缺点:一种是API的使用受到限制,您可以将页面的JavaScript绑定到本机代码,但是并非所有功能都可用.尽管您可能想看看

Disadvantages: One is that the API use is limited, you can bind a page's JavaScript to Native code, but not all functionality is available.Though you might want to have a look at capabilities of Cordova project. Another is that emulating complex widgets via JavaScript will slow down the page.

可移植性:确实是一个很大的优势,这就是 PhoneGap 切换到本机应用程序以获得更好的性能.

Portability: Indeed is a great advantage, that's why PhoneGap and Cordova are popular. Though many like Facebook App etc have switched to native App for better performance.

您所需的方法实际上取决于您的要求.这可能是我的个人言论,但是恕我直言:标记只能扭曲到目前为止,它到目前为止还不能胜过工业级GUI编程设置.

The approach you require actually depends on your requirements. This may be my personal rant but IMHO: a markup can be only twisted so far, it can't out-perform industrial grade GUI programming setups as of yet.

这篇关于在本机Android应用程序中使用WebView整体布局是否有用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆