Is it useful using WebView whole layout in native Android app?

后端 未结 3 1338
[愿得一人]
[愿得一人] 2021-02-04 04:05

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 webvie

相关标签:
3条回答
  • 2021-02-04 04:33

    I think -by using this way- your app quality will be weak and app will be hard to use because the webview object not having a lot of tools that you can make it be compatible with android. e.g you can't share or save data from your webview to app. whatever that reference on your app what need and what dosen't need, by the way i tried to develop an app with html but it was bad.

    0 讨论(0)
  • 2021-02-04 04:34

    Cons WebView

    • Can't use full performance of device, Since web view form an extra layer.
    • Web view can't listen all user event.
    • You can't fully share or save data from your web view to app.
    • Take more time to load. Other we get all things in a simple API and can be rendered.
    • Changing a simple fields in page need to load full page again.
    • Online required, can't extend offline features.
    • Orientation changes and full screen make difficulties.

    Pros of using Web view

    • One page for both android and IOS.
    • I think the main advantage is the ability to make changes without the need for each user to update the app on his device, because all the pages are on your server.
    • No wait for app store approval for updation.

    Some Techniques

    • Native elements TOGETHER with WebView. I think it will be much better, as there are a lot of functions that can't be done with WebView only. The combination of the two is much more recommended.
    • Rendering from locally, Create an assets directory for HTML files – Android internally maps it to file:///android_asset/ (note singular asset). So you can feed your web view form locally even if you are offline.
    0 讨论(0)
  • 2021-02-04 04:37

    There is a very good presentation about this very topic.

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

    2. 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.

    3. 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.

    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.

    0 讨论(0)
提交回复
热议问题