Note that there are some explanatory texts on larger screens.

plurals
  1. POWebview in Scrollview
    primarykey
    data
    text
    <p>I have to place WebView into ScrollView. But I have to put some views into the same scrollview before webview. So it looks like this:</p> <pre><code>&lt;ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;LinearLayout android:id="@+id/articleDetailPageContentLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"&gt; &lt;LinearLayout android:id="@+id/articleDetailRubricLine" android:layout_width="fill_parent" android:layout_height="3dip" android:background="@color/fashion"/&gt; &lt;ImageView android:id="@+id/articleDetailImageView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:scaleType="fitStart" android:src="@drawable/article_detail_image_test"/&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="5dip" android:text="PUBLISH DATE"/&gt; &lt;WebView android:id="@+id/articleDetailContentView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/fashion" android:isScrollContainer="false"/&gt; &lt;/LinearLayout&gt; </code></pre> <p></p> <p>I'm getting some HTML info from backend. It has no any body or head tags, just data surrounded by <code>&lt;p&gt;</code> or <code>&lt;h4&gt;</code> or some other tags. Also it has <code>&lt;img&gt;</code> tags in there. Sometimes pictures are too wide for current screen width. So I added some css in the begining of HTML. So I loads data to webview like this:</p> <pre><code>private final static String WEBVIEW_MIME_TYPE = "text/html"; private final static String WEBVIEW_ENCODING = "utf-8"; String viewport = "&lt;head&gt;&lt;meta name=\"viewport\" content=\"target-densitydpi=device-dpi\" /&gt;&lt;/head&gt;"; String css = "&lt;style type=\"text/css\"&gt;" + "img {width: 100%;}" + "&lt;/style&gt;"; articleContent.loadDataWithBaseURL("http://", viewport + css + articleDetail.getContent(), WEBVIEW_MIME_TYPE, WEBVIEW_ENCODING, "about:blank"); </code></pre> <p>Sometimes when page loaded, scrollview scrolls to place where webview begins. And I don't know how to fix that.</p> <p>Also, sometimes there is huge white empty space appears after webview content. I also don't know what to do with that.</p> <p>Sometimes scrollview's scrollbars starts twitch randomly while I scrolling...</p> <p>I know that it's not right to place webview into scrollview, but it seems like I have no other choise. Could anyone suggest rigth way to place all views and all HTML content to webview?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload