android - How to Shrink WebView size dynamically according to its content? -


The problem can be understood from a detailed explanation because the user added the image to make it better.

I am loading HTML content in my webview. There are several views in my layout and are located inside the webview scrollview (as required by layout). Please do not reply - "Do not insert webview inside scrollview" . I know that there is no good reason to keep webview in the scroll-vee, but I need to do this as per requirement.

Therefore, I have left section (showing list item) and right piece (showing data shown on selection of list item from left pieces). Now, first of all, when I load the HTML content in WebView, it shows the right. After this, when I refresh the webview with the new HTML content, the problem arises.

Suppose, my first HTML content is 100 lines which show correctly and then I reload the webview with my new HTML content which is 40 lines webview with 40 lines Containing content and not fitting, it is still showing up to 100 lines white / spaces below.

It seems that the webview is again capable of resizing itself with less content that has been loaded in more than ever before, but when the content is less than the content previously loaded, then it is again Unable to shape from

I tried several ways,

  • Apart from this, many other ways and blogs
  • I also Tried: Android: hardware accelerated = "true" mWebView.clearView (); , which causes the size of WebView to resize, but sometimes WebView starts getting started, which is just annoying.

    Similar to

    However, no suitable solution could be found. If any of you ask me the best solution to apply before the same problem.

    UPDATE -

    After going ahead, it seems that this is a famous issue in Honeycomb. This also indicates a similar problem.

    It seems that there is no way to change the size of WebView (decrease) its size dynamically Once filled with it, therefore, the only thing that could solve my problem was reloading the entire web. Therefore, rather than defining the fragmentation in XML, I dynamically changed my content by adding each one. Through which I was able to solve my problem.

    Hope this will help others in the future!

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -