views:

24

answers:

1

It appears that my WebView is ALWAYS FULL screen and doesn't respect the layout .

Also, Activity menus are not the ones I set but the browsers.

If the URL is www.google.com in mobile mode or stackoverflow.com it appears to work ok !?!

But once you click on Classic mode or any other web site in mobile/regular it takes up the whole screen.

It works ok with loadData.

Thanks in advance!!

Any ideas ?

Michael

I am testing on an 2.1 android emulator.

Code snippet .........

setContentView(R.layout.mainactivity);
WebView webV = (WebView)findViewById(R.id.webview);
webV.setInitialScale(30);
webV.loadUrl(getString(R.string.app_url));

Layout ....

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent android:layout_height="fill_parent">

<TextView android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type here:"/> 

<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_below="@id/label"
/> 

</RelativeLayout>
A: 

This isn't the WebView's fault; when a link gets clicked inside the WebView the default behavior is to open the system Browser app with the URL (see #6 on the WebView tutorial).

This is actually a duplicate of this SO question; short answer is that you'll need to set up a WebViewClient for the WebView and set shouldOverrideUrlLoading.

Yoni Samlan