Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 将图像从web服务添加到地图标记图标_Android_Web Services_Google Maps_Google Maps Api 3_Google Maps Markers - Fatal编程技术网

Android 将图像从web服务添加到地图标记图标

Android 将图像从web服务添加到地图标记图标,android,web-services,google-maps,google-maps-api-3,google-maps-markers,Android,Web Services,Google Maps,Google Maps Api 3,Google Maps Markers,我在drawable文件夹中有一个图标图像,我将其设置为map marker icon,但我需要在我要显示图像的现有标记上方设置一个图像 *第一个图像是一个自定义标记,它是静态的,我从drawable文件夹获得它 *第二个是我从web服务url获得的一个简单图像** 上面的代码用于查看地图上的标记图标。但是我需要在上面显示另一个图像。所以我通过web服务获取url,如下代码所示 try { URL url = new URL(CommonUtilities.Thumb_Call+

我在drawable文件夹中有一个图标图像,我将其设置为map marker icon,但我需要在我要显示图像的现有标记上方设置一个图像

*第一个图像是一个自定义标记,它是静态的,我从drawable文件夹获得它

*第二个是我从web服务url获得的一个简单图像**

上面的代码用于查看地图上的标记图标。但是我需要在上面显示另一个图像。所以我通过web服务获取url,如下代码所示

try {   
     URL url = new URL(CommonUtilities.Thumb_Call+ item.vendor_icon);
     bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
      bmp = BitmapFactory.decodeFile(String.valueOf(url));
     } 
     catch (Exception e) 
      {
         e.printStackTrace();
    }

请帮助我设置来自url的标记上方的图像。

此问题可以通过以下方式解决:

首先创建自定义的_marker_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<ImageView
    android:id="@+id/imageView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/markertoemp"
    tools:ignore="VectorDrawableCompat" />

<ImageView
    android:id="@+id/inside"
    android:layout_width="32.25dp"
    android:layout_height="32.25dp"
    android:layout_centerInParent="true"
    android:layout_marginBottom="22dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    app:layout_constraintBottom_toBottomOf="@+id/imageView4"
    app:layout_constraintEnd_toEndOf="@+id/imageView4"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/imageView4"
    app:srcCompat="@drawable/ic_delevery_primary"
    tools:ignore="MissingConstraints,VectorDrawableCompat" />

</android.support.constraint.ConstraintLayout>

祝你好运:

嘿,请点击下面的链接,这可能会给你一些想法-我知道如何设置标记,但不知道如何在标记上方设置另一个图像你可以使用图片编辑工具在第一个图像上添加第二个图像。。。这是我唯一能看到的。非程序化是可能的,程序化我不认为你知道任何一种编辑工具@sud吗?谷歌上有很多在线照片编辑工具。只需谷歌“在线照片编辑器”
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<ImageView
    android:id="@+id/imageView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/markertoemp"
    tools:ignore="VectorDrawableCompat" />

<ImageView
    android:id="@+id/inside"
    android:layout_width="32.25dp"
    android:layout_height="32.25dp"
    android:layout_centerInParent="true"
    android:layout_marginBottom="22dp"
    android:layout_marginEnd="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    app:layout_constraintBottom_toBottomOf="@+id/imageView4"
    app:layout_constraintEnd_toEndOf="@+id/imageView4"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="@+id/imageView4"
    app:srcCompat="@drawable/ic_delevery_primary"
    tools:ignore="MissingConstraints,VectorDrawableCompat" />

</android.support.constraint.ConstraintLayout>
    private void setUpMap(final EmpMarker emp) {
    LatLng empLatLog = new LatLng(emp.getLatitude(), emp.getLongitude());

    View marker = ((LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.lyout.custom_marker_layout, null);
    ImageView imageView = marker.findViewById(R.id.inside);
    GlideApp.with(activity).load(URLs.Glide_URL + imgeSub).apply(RequestOptions.circleCropTransform()).into(imageView);

    new Handler().postDelayed(() -> {
        customMarker = mMap.addMarker(new MarkerOptions()
                .position(empLatLog)
                .icon(BitmapDescriptorFactory.fromBitmap(createDrawableFromView(marker))));
        customMarker.setTag(emp);
    }, 10);
 }