In my application, it has a webview and link buttons.
If I click on the button, webview loads the destination pages.
Some pages fit in webview and they look fine, but some are not.
In every loaded pages, they have this
<meta name="viewport" content="width=device-width, initial-scale=0.8">
so they should look all the same:(
What's wrong with my code?
public class MainActivity extends Activity {
private ActionBar mActionBar;
private SimpleSideDrawer mNav;
WebView myWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myWebView = (WebView)findViewById(R.id.webView1);
myWebView.setWebViewClient(new WebViewClient());
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.loadUrl("http://example-site.com/");
myWebView.getSettings().setSupportZoom(true);
myWebView.getSettings().setLoadWithOverviewMode(true);
myWebView.getSettings().setUseWideViewPort(true);
}
}
//This will be called when the button is clicked
public void loadThisUrl(String url) {
mNav.closeLeftSide();
mNav.closeRightSide();
myWebView.loadUrl(url);
}
UPDATE
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>