Füge ein Bild für das Android Marker Infofenster hinzu

Ich mache eine Android App. In dieser App gibt es Markierungen einiger Hotels und wenn der Benutzer auf das Markierungsinfofenster klickt, sollte dies wie im folgenden Bild aussehen. (Dies ist eine Webanwendung)

Ich habe eine Listenansicht in meinem Navigationsfachfragment und das Kartenfragment hat die Markierungen.

Dies ist mein Code, bevor ich versuche, ein Bild für das Infofenster in @ zu ladeMainActivity.java.

  // Load Hotels
    private class GetHotelTask extends AsyncTask<String, String, String> {
        @Override
        protected String doInBackground(String... data) {
            String identifier = data[0];

            // Toast.makeText(getContext(), "Manuli "+identifier, Toast.LENGTH_LONG ).show();
            // Create a new HttpClient and Post Header
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost("http://api.ayubo.lk/android/retrievehotels");
            HttpResponse response = null;
            String responseStr = null;

            try {
                //add data
                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);
                nameValuePairs.add(new BasicNameValuePair("long", data[0]));
                nameValuePairs.add(new BasicNameValuePair("lat", data[1]));
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                //execute http post
                response = httpclient.execute(httppost);
                responseStr = EntityUtils.toString(response.getEntity());

            } catch (ClientProtocolException e) {
                e.printStackTrace();

            } catch (IOException e) {
                e.printStackTrace();
            }

            return responseStr;
        }

        protected void onPostExecute(String result) {

            try {
                JSONArray jObj = new JSONArray(result);

                for(int a=0;a<jObj.length();a++){

                JSONArray obj= (JSONArray) jObj.get(a);

                    Log.i("json", obj.get(3).toString());
                    Marker marker = GoogleMapsFragment.map.addMarker(new MarkerOptions()
                            .position(new LatLng( Double.valueOf(obj.get(3).toString()),  Double.valueOf(obj.get(2).toString())))
                            .title(obj.get(1).toString()+" | simple Price : "+obj.get(4).toString())
                            .snippet(obj.get(5).toString())
                            .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_marker_hotel)));


                    hotelMarkers.add(marker);

                }

                LatLng latLng = new LatLng(Double.valueOf(latitude),Double.valueOf(longtitude));

                GoogleMapsFragment.map.moveCamera(CameraUpdateFactory.newLatLng(latLng));

                GoogleMapsFragment.map.animateCamera(CameraUpdateFactory.zoomTo(15));

            } catch (JSONException e) {
                Log.e("JSON Parser", "Error parsing data " + e.toString());
            }

        }

    }

Hier ist die Listenansicht der Hotels inMainActivity.java.

// Hotels
            case 0:
                if (A == 0){
                    Bundle bundle = new Bundle();
                    bundle.putString("restaurants", "Default");
                    fragmentObj = new GoogleMapsFragment();
                    fragmentObj.setArguments(bundle);

                    if (!sclItems.contains(0)){
                        new GetHotelTask().execute(longtitude, latitude);
                        sclItems.add(0);
                    }else {
                        removeHotels();
                        sclItems.remove((Integer)0);
                    }
                    A = 1;
                }else {
                    if (!sclItems.contains(0)){
                        new GetHotelTask().execute(longtitude, latitude);
                        sclItems.add(0);
                    }else {
                        removeHotels();
                        sclItems.remove((Integer)0);
                    }
                }
                break;

Ich habe versucht, @ hinzufüginfo_window_layout.xml und hier ist der Code.

<?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="horizontal">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:adjustViewBounds="true"
            android:src="@drawable/ic_prof"/>
        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="12dp"
            android:textStyle="bold"/>
        <TextView
            android:id="@+id/snippet"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="10dp"/>
    </LinearLayout>

</LinearLayout>

Aber ich kann mein Infofenster nicht wie im Bild laden. Ich habe verschiedene Lösungen ausprobiert, darunterDie und nichts davon gab mir eine Lösung.

Kann mir bitte jemand dabei helfen?

Danke im Voraus. :)

Error

Antworten auf die Frage(8)

Ihre Antwort auf die Frage