2010-07-09 3 views
1

내 WebView가 항상 화면 가득 차서 레이아웃을 존중하지 않는 것 같습니다.WebView 버그 - 정확하게 크기가 맞지 않음

또한 활동 메뉴는 내가 설정 한 것이 아니라 브라우저입니다.

모바일 모드에서 URL이 www.google.com이거나 stackoverflow.com 인 경우 제대로 작동하는 것 같습니다.

하지만 모바일 모드 나 일반 모드에서 클래식 모드 나 다른 웹 사이트를 클릭하면 전체 화면을 차지합니다.

loadData를 사용하면 문제가 없습니다.

미리 감사드립니다.

아이디어가 있으십니까?

마이클

2.1 android 에뮬레이터에서 테스트 중입니다.

코드 .........

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

레이아웃 ....

<?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> 

답변

0

이것은 웹보기의 잘못이 아닙니다; WebView 안에 링크가 클릭되면 기본 동작은 URL이있는 시스템 브라우저 앱을 여는 것입니다 (WebView tutorial의 # 6 참조).

이것은 실제로는 this SO question의 복제입니다. 짧은 대답은 WebView에 대해 WebViewClient을 설정하고 shouldOverrideUrlLoading을 설정해야한다는 것입니다.

관련 문제