Note that there are some explanatory texts on larger screens.

plurals
  1. POWebview not re-sizing on orientation change
    text
    copied!<p>When my phone loads a story, it displays it nice and pretty, but once it is turned landscape there is a lot of extra white space inside of the webview. No matter what I have tried to do, I can't seem to remove them. From what I can tell, the height is not readjusting when the orientation is changed. I manage my own orientations, and everything seems to re-size properly, just not this one webview. </p> <pre><code>protected void displayStory() { //FontSize(); // TODO Display Stories art_title = (TextView) findViewById(R.id.display_title); art_title.setText(articleTitle); art_title.setVisibility(View.VISIBLE); art_author = (TextView) findViewById(R.id.display_author); art_author.setText(articleAuthor + " | " + articleDate); art_author.setVisibility(View.VISIBLE); web = new WebView(this); web = (WebView) findViewById(R.id.WebView01); web.setHorizontalScrollBarEnabled(false); web.setVerticalScrollBarEnabled(false); web.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); web.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); web.getSettings().setJavaScriptEnabled(true); web.getSettings().setMinimumFontSize(14); //web.getSettings().setLoadWithOverviewMode(true); web.getSettings().setUseWideViewPort(false); web.getSettings().setPluginState(PluginState.ON); //web.loadDataWithBaseURL("", articleContent, "text/html", "UTF-8", ""); web.loadData(articleContent, "text/html", "UTF-8"); //FontSize(); }//end displayStory @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); //setContentView(R.layout.pm_article); //web.clearView(); //web = null; //displayStory(); ads(); </code></pre> <p>My xml looks like</p> <pre><code>&lt;ScrollView android:id="@+id/scrollView1" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:scrollbarStyle="outsideOverlay" &gt; &lt;RelativeLayout android:id="@+id/RelativeLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#86a6b2" android:orientation="vertical" android:paddingBottom="20dp" &gt; &lt;LinearLayout android:id="@+id/LinearLayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:background="@drawable/sm_section" android:orientation="vertical" android:paddingBottom="10dp" android:paddingTop="10dp" &gt; &lt;TextView android:id="@+id/display_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:text="Title" android:textColor="#ffffff" android:textSize="20sp" android:visibility="gone" /&gt; &lt;TextView android:id="@+id/display_author" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="7dp" android:layout_marginRight="7dp" android:text="Author" android:textColor="#d2d2d2" android:visibility="gone" /&gt; &lt;TextView android:id="@+id/display_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="7dp" android:layout_marginRight="7dp" android:text="Date" android:textColor="#d2d2d2" android:visibility="gone" /&gt; &lt;/LinearLayout&gt; &lt;WebView android:id="@+id/WebView01" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/LinearLayout1" android:layout_marginBottom="10dp" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="10dp" android:background="#b6fcd5" android:fitsSystemWindows="true" android:focusable="false" android:focusableInTouchMode="false" android:scrollbarStyle="insideOverlay" /&gt; &lt;WebView android:id="@+id/webViewLandAd" android:layout_width="match_parent" android:layout_height="66dp" android:layout_below="@+id/WebView01" android:background="#d3414a" android:fitsSystemWindows="true" /&gt; &lt;LinearLayout android:id="@+id/LinearLayout2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/webViewLandAd" android:layout_marginTop="20dp" android:background="@drawable/sm_section" android:paddingBottom="5dp" android:paddingLeft="15dp" android:paddingRight="15dp" android:paddingTop="5dp" &gt; &lt;Button android:id="@+id/button1" android:layout_width="140dp" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:onClick="openComments" android:text="Comments" android:textColor="@color/white" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="1" android:ellipsize="end" android:gravity="right|center_vertical" android:singleLine="true" android:text="Pamplin Media Group" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="@color/white" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; &lt;/ScrollView&gt; </code></pre> <p>And my manifest:</p> <pre><code> &lt;activity android:name="com.portlandtribune.pamplinmediagroup.PM_article" android:configChanges="orientation|screenSize" android:label="@string/title_activity_pm_article" &gt; </code></pre> <p>Here are screenshots of what is going on.</p> <p>This is when the phone is in portrait mode. The text is displayed as it should be. <img src="https://i.stack.imgur.com/Q94Cx.png" alt="enter image description here"></p> <p>And when the phone is in landscape. The bottom of the webview is just blank text. <img src="https://i.stack.imgur.com/Yi3Oe.png" alt="enter image description here"></p>
 

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