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

后端 未结 3 1337
[愿得一人]
[愿得一人] 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: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.

提交回复
热议问题