开发者

android webview displaying only partial webpage content

I am writing a program that will encompass many thing but one being an interactive campus wide map. Rather than rewriting the mapview for custom purposes and keeping in mind this style map is common for college campus's I've found webview to be nearly perfect to my plan of attack.

final WebView myMapWebView = (WebView) findViewById(R.id.mapW开发者_JAVA技巧ebView);
myMapWebView.getSettings().setJavaScriptEnabled(true);
myMapWebView.setWebViewClient(new HelloWebViewClient(){
});
myMapWebView.loadUrl("http://campusmaps.umn.edu/tc/campusviewer.html");
}

private class HelloWebViewClient extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
        return true;
    }
}

This displays the loading bar the webpage shows as well, the header from the webpage (albeit scrunched) their navigation, compass, map location or what ever is at the bottom right of the map, and the radio buttons for map style but no map. Anyone have any ideas on why this map is not loading into the webview?


check your settings in layout.xml and make sure both the WebView and its parent layout have match_parent set under layout_height like this:

<?xml version="1.0" encoding="utf-8"?>
    <ScrollView 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/LinearLayout01" android:scrollbarSize="20px">
        <LinearLayout android:orientation="vertical"
            android:layout_width="match_parent" 
            android:layout_height="match_parent">
                <WebView android:id="@+id/appView" 
                    android:layout_height="match_parent"
                    android:layout_width="match_parent" />
        </LinearLayout>
    </ScrollView>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜