2014-05-21 44 views
0

爲了webview,我寫了html5和javascript,jquery相關的代碼。下面的代碼將信息窗口設置爲marker.Please告訴我這將是什麼錯誤代碼。爲什麼webview在android中的標記的信息窗口中不可見

map.setInfoWindowAdapter(new InfoWindowAdapter() { 
            @Override 
            public View getInfoWindow(Marker arg0) { 
             return null; 
            } 

            @Override 
            public View getInfoContents(Marker arg0) { 
             View v = getLayoutInflater().inflate(R.layout.popups, 
               null); 
             WebView webView = (WebView) v 
               .findViewById(R.id.webview_popup); 
             TextView open = (TextView) v 
               .findViewById(R.id.open_popup); 

             webView.getSettings().setJavaScriptEnabled(true); 

             webView.loadDataWithBaseURL("file:///android_asset/",objectValue.trim(), 
               "text/html", "utf-8", null); 
             open.setText("Open"); 
             return v; 
            } 
           }); 

這裏objectValue意味着Html5的字符串類型

+0

請前往[http://stackoverflow.com/questions/15989891/android-setinfowindowadapter-with-webview-in-google-marker-api-v2?rq = 1](http://stackoverflow.com/questions/15989891/android-setinfowindowadapter-with-webview-in-google-marker-api-v2?rq=1) –

+0

好的,thanks.how將webview轉換爲imageview如果webview不支持 – Surekha

回答

1

在谷歌地圖Android的信息窗口不是實際的機器人view組件。它是如何工作的,當你從getInfoContent返回視圖時,它基本上將視圖渲染爲圖像,並將該圖像放入infowindow中,所以在你的情況下,當你返回webview地圖時,將主要在圖像上繪製它,花時間加載和解析並將html內容呈現給內部畫布),所以當地圖渲染時它將是一個空的web視圖。請參閱參考文檔稱它不是實時視圖https://developers.google.com/maps/documentation/android/infowindows#custom_info_windows

相關問題