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文件。我会立即更新问题。提前致谢。