Android アプリケーションを開発していますが、マップへの画像のダウンロードに問題があります。私のアプリケーションでは、Google マップ v2 と Aquery を使用して画像をダウンロードしています。ユーザーが地図上のマーカーをクリックしたときに関連する画像を表示したい。これは、その機能を実現しようとしているコード スニペットです。
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();
同様のコードを使用してカスタムビューに画像を表示できるカスタムリストビューもありますが、マップフラグメントでは画像が表示されません。
これはマーカーのxmlファイルです
<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>
さらに情報が必要な場合は、お知らせください。すぐに質問を更新します。前もって感謝します。