White space is added at the bottom when I put a webview inside scrollview in android

I have a Webview that looks like an Expandable Listview in android. It works well when I just load this into a WebView.

But when I keep it in ScrollView, it adds white space at the bottom of the screen

XML:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="fill_parent" android:layout_height="300dp" android:background="#000000" ></LinearLayout> <WebView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/webview"/> </LinearLayout> </ScrollView> </LinearLayout> 

This is before clicking the tabs on the screen. enter image description here

After clicking on the tabs, white space is added from the bottom, and also moves to the lower empty space when you click on some of the tabs.

my java code is:

 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.scroll_example); mwebview = (WebView) findViewById(R.id.webview); mwebview.loadUrl("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxent-Executive/664900.html?creport=true&frompage=mobileapi"); WebSettings webSettings = mwebview.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setBuiltInZoomControls(true); mwebview.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); mwebview.setWebViewClient(new WebViewClient()); } 

The "white space" is added from the bottom and it is adjusted when you click the last tab (i.e. conditions and conditions). enter image description here

I really did not understand whether it was necessary to modify this on the Php side, for example, on the Html data side or on our java side.

can anybody suggest for a solution.

+6
source share
1 answer
Have you thought about something like that? Try using scrollview as the root view, good luck!
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#000000" ></LinearLayout> <WebView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/webview"/> </LinearLayout> </ScrollView> 
0
source

Source: https://habr.com/ru/post/972766/


All Articles