Stop Android webview covering tabwidget

I have a tab located at the bottom of the screen with an inscription above it. When the contents of a web page load a web view larger than the screen, the web view expands to convert tabwidget - since layout_height is set to wrap_content in the webview and in the scrollview it is in.

I need the scrollview to resize to the available screen space. My xml is as follows:

<TabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" > <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="0dp" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginBottom="-4dp" android:gravity="top" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" > <ScrollView android:id="@+id/scroll1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="none" tools:ignore="UselessParent" > <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="bottom"/> </ScrollView> </FrameLayout> </RelativeLayout> 

I set the height of the scroll set, but, as expected, it is true only for a specific device (s), but not universal.

Any help would be appreciated.

+4
source share
1 answer

use this xml, it will solve your problem:

 <TabHost xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="0dp" > <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" > <ScrollView android:id="@+id/scroll1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="none" tools:ignore="UselessParent" > <WebView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="bottom" /> </ScrollView> </FrameLayout> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> </TabHost> 
0
source

All Articles