Search code examples
androidgoogle-mapsinfowindowmarkerclusterer

Android Map Custom info window with box shape on bottom in Clusterer


I need to make custom info window for my android application; like below. Please see the image below.

This info window appears when user clicked on the marker. It can show on the top of the map or on the bottom of the map according marker position.

I don't have idea to make this. I have explored stackoverflow, many ways to create custom info windows, but for this one, I haven't found any solution here. So, can somebody tell me how to build that?

enter image description here


Solution

  • You can set programmatically custom window by this code..onClick of your button

    LayoutInflater inflater = LayoutInflater.from(this);
    final Dialog dialog1 = new Dialog(this);
    Window window = dialog1.getWindow();
    WindowManager.LayoutParams wlp = window.getAttributes();
    wlp.gravity = Gravity.BOTTOM; // Here you can set window top or bottom
    wlp.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
    window.setAttributes(wlp);
    View view1 = inflater.inflate(R.layout.openYourWindow, null);
    dialog1.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog1.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    dialog1.setContentView(view1);
    dialog1.show();