** I am trying this...**
take Layout set height to webview to as you wish
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@color/colorAccent"
android:weightSum="1">
<WebView
android:id="@+id/webView"
android:layout_width="0dp"
android:layout_height="1000dp"
android:layout_weight="0.50"
>
</WebView>
<WebView
android:id="@+id/webView2"
android:layout_width="0dp"
android:layout_height="1000dp"
android:layout_weight="0.50">
</WebView>
</LinearLayout>
</ScrollView>
=Try this FOr match parent I am trying to Fix height than it's work try more to match parent by this
android:fillViewport="true"
android:scrollbars="vertical"
Code
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
private WebView webView1,webView2;
private static final String TAG = "TAGGBOX";
private ProgressDialog progressBar;
// check secret prefix
String msg="";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.demo);
SetypUI();
WebSettings settings = webView1.getSettings();
WebSettings settings1 = webView2.getSettings();
settings.setJavaScriptEnabled(true);
settings1.setJavaScriptEnabled(true);
//ws.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings1.setJavaScriptCanOpenWindowsAutomatically(true);
// /wcc = new MyWebChromeClient();
webView1.setScrollContainer(false);
webView2.setScrollContainer(false);
webView1.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return (event.getAction() == MotionEvent.ACTION_MOVE);
}
});
webView2.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return (event.getAction() == MotionEvent.ACTION_MOVE);
}
});
webView1.setVerticalScrollBarEnabled(false);
webView1.setHorizontalScrollBarEnabled(false);
webView2.setVerticalScrollBarEnabled(false);
webView2.setHorizontalScrollBarEnabled(false);
webView1.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webView2.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webView1.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.i(TAG, "Processing webview url click..."+url);
view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
Log.e(TAG, "Finished loading URL: " + url);
//webview.reload();
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
/* Log.e(TAG, "Error: " + description);
Toast.makeText(MainActivity.this, "Please Check the Internet Connection", Toast.LENGTH_SHORT).show();
alertDialog.setTitle("Error");
alertDialog.setMessage("Please Check the Internet Connection");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alertDialog.show();*/
}
});
webView1.loadUrl("http://stackoverflow.com/");
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
webView2.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Log.i(TAG, "Processing webview url click..."+url);
view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
Log.e(TAG, "Finished loading URL: " + url);
//webview.reload();
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
/* Log.e(TAG, "Error: " + description);
Toast.makeText(MainActivity.this, "Please Check the Internet Connection", Toast.LENGTH_SHORT).show();
alertDialog.setTitle("Error");
alertDialog.setMessage("Please Check the Internet Connection");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
}
});
alertDialog.show();*/
}
});
webView2.loadUrl("http://stackoverflow.com/");
}
private void SetypUI() {
webView1 = (WebView) findViewById(R.id.webView);
webView2 = (WebView) findViewById(R.id.webView2);
}
}