1
我正在開發Android應用程序,並將圖像下載到我的地圖時遇到問題。在我的應用程序中,我使用Google Maps v2和Aquery來下載圖像。我想在用戶點擊地圖上的標記時顯示相關圖像。這是我試圖實現該功能的代碼片段。使用Aquery將圖像下載到Google地圖標記
googleMap
.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
String allText = marker.getSnippet();
String[] bodyTextArray = allText.split("(;;)");
String bodyText = "";
String idText = "";
String imagePath = "";
if (bodyTextArray.length == 3) {
idText = bodyTextArray[0];
bodyText = bodyTextArray[1];
imagePath = bodyTextArray[2];
}
final View content2 = getActivity()
.getLayoutInflater().inflate(
R.layout.map_marker, null);
AQuery aquery = new AQuery(getActivity(), content2);
aquery.id(R.id.ivInfoWindowMain)
.image(Utility.webSiteAddress + imagePath,
true, true, 0, 0, null,
AQuery.FADE_IN_NETWORK, 1.0f)
.visible();
Problem problemPass = null;
Object[] problemArray = problemSet.toArray();
我也有一個自定義列表視圖我可以顯示地圖片段但是使用類似的代碼在自定義視圖圖像中的圖像中未示出。
這是標誌
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/ivInfoWindowMain"
android:layout_width="200dip"
android:layout_height="200dip"
android:layout_marginRight="5dp"
android:contentDescription="@string/image"
android:adjustViewBounds="true" >
</ImageView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/txtInfoWindowTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff000000"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:id="@+id/txtInfoWindowEventType"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLength="40"
android:ellipsize="end"
android:singleLine="true"
android:textColor="#ff7f7f7f"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
如果您需要了解更多信息,請讓我知道的XML文件。我會立即更新問題。提前致謝。