我在google maps api v2上有標記問題。 我想自定義信息窗口具有的WebView:Android - 帶有WebView的setInfoWindowAdapter在google標記(api v2)
這裏我InfoWindowAdapter
mMap.setInfoWindowAdapter(new InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker arg0) {
return null;
}
@Override
public View getInfoContents(Marker arg0) {
View v = getLayoutInflater().inflate(R.layout.info_window_layout, null);
TextView title = (TextView) v.findViewById(R.id.title_marker);
WebView snippet = (WebView) v.findViewById(R.id.item_snippet);
title.setText(arg0.getTitle());
snippet.setVisibility(WebView.VISIBLE);
snippet.loadData(arg0.getSnippet(),"text/html", "UTF-8");
return v;
}
});
的代碼是這樣的佈局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/title_marker"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<WebView
android:id="@+id/item_snippet"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
我的問題是,我看到的內容進入TextView,但不包含到WebView中的內容。 我做錯了什麼? 非常感謝
感謝您的回答。我試過[鏈接] http://stackoverflow.com/questions/6747701/how-to-convert-a-webview-into-an-imageview中的代碼,但它返回一個空白圖像。我不知道爲什麼。你能幫我嗎?再次感謝 – user2277798