2013-05-23 2 views
3

이제이 코드를 사용하여 기본 사각형 모양을 표시했습니다. Google지도 api v2의 맞춤 InfoWidnow 모양을 변경하는 방법

this.infoWindow = (ViewGroup)getLayoutInflater().inflate(R.layout.newcustomdialog, null); 
this.infoImage=(ImageView)infoWindow.findViewById(R.id.graphicimage); 
this.infoTitle = (TextView)infoWindow.findViewById(R.id.balloon_item_title); 
this.infoSnippet = (TextView)infoWindow.findViewById(R.id.balloon_item_snippet); 
this.close=(Button)infoWindow.findViewById(R.id.close_img_button); 
this.infoButton = (Button)infoWindow.findViewById(R.id.more); 
    // 
    // Setting custom OnTouchListener which deals with the pressed state 
    // so it shows up 
this.infoButtonListener = new OnInfoWindowElemTouchListener(HomeScreen.this,infoButton) 
{ 
     @Override 
     protected void onClickConfirmed(View v, Marker marker) { 
      // v.setVisibility(View.GONE); 
      // Here we can perform some action triggered after clicking the button 
     Toast.makeText(HomeScreen.this, marker.getTitle() + "'s button clicked!", Toast.LENGTH_SHORT).show(); 
     } 

}; 
    //oraii 
this.exitButtonListener=new OnInfoWindowExitListener(HomeScreen.this,infoWindow) { 

    @Override 
    protected void onClickConfirmed(View v, Marker marker) { 
     // TODO Auto-generated method stub 

    } 
}; 

this.infoButton.setOnTouchListener(infoButtonListener); 
this.close.setOnTouchListener(exitButtonListener);  

map.setInfoWindowAdapter(new InfoWindowAdapter() { 
     public View getInfoWindow(Marker marker) { 
      return null; 
     } 

     public View getInfoContents(Marker marker) { 
      // Setting up the infoWindow with current's marker info 
     StringTokenizer st2 = new StringTokenizer(marker.getTitle(), ","); 

      String imageurl=""; 
      String title=""; 
      String eventid=""; 
      while (st2.hasMoreElements()) { 
       eventid=st2.nextElement().toString(); 
       imageurl=st2.nextElement().toString(); 
       title=st2.nextElement().toString(); 
      } 
      EventId=eventid; 
      infoTitle.setText(title); 
      infoSnippet.setText(marker.getSnippet()); 
      imageLoader.DisplayImage(imageurl,HomeScreen.this, infoImage); 
      infoButtonListener.setMarker(marker); 
      exitButtonListener.setMarker(marker); 

      // We must call this to set the current marker and infoWindow references 
      // to the MapWrapperLayout 
      mapWrapperLayout.setMarkerWithInfoWindow(marker, infoWindow); 
      return infoWindow; 
     } 
    }); 

내가 심장 모양으로 모양을 변경하려면

는 차트 대화 shape..how 같은 사용자 정의 모양은 어떤 몸이 알고 있다면 하나 .. PLZ 도와 그렇게하는 것을 의미합니다. now i am getting like this

+0

1 개 심장 모양의 이미지를 만들어 배경으로 설정 내가 :) ...이 알려 작동하는 경우 created..you이 ... 나보다 이미지를 더 추가 할 수 있습니다 단지 이미지입니다 사용자 정의 정보 윈도우 레이아웃. – TheFlash

+0

심지어 사용자 정의 창을 만들었지 만 해당 창은 기본 사각형 창 안에 표시됩니다. @Pratik – Venkat

+0

http://stackoverflow.com/questions/16317224/custom-infowindow-with-google-maps-api-v2/16318403#16318403 @ Venkat – Shadow

답변

14

custom_infowindow.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="110dp" 
    android:layout_height="110dp" 
    android:orientation="vertical" 
    android:background="@drawable/heart" 
    android:gravity="center" 
    > 

<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
> 

<Button 
    android:layout_width="40dp" 
    android:layout_height="20dp" 
    android:layout_alignParentTop="true" 
    android:layout_marginLeft="60dp" 
    android:layout_marginTop="15dp" 
    android:text="Click!" 
    android:textColor="#ffffff" 
    android:textSize="10dp" 
    android:background="#373737"/> 

<TextView 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:text="HELLO" 
android:textColor="#FF0000" 
android:padding="10dp" 
android:layout_centerInParent="true" 
android:background="#00000000" 
/> 

</RelativeLayout> 

</LinearLayout> 

이 당신의 심장 모양 layout..copy과 응용 프로그램의 drable 폴더에 붙여 넣습니다 ... lolz Check This Download it

위의보기를 사용자 정의 정보창으로 부풀려보세요 ..!

mMap.setInfoWindowAdapter(new InfoWindowAdapter() { 

    public View getInfoWindow(Marker arg0) { 
     View v = getLayoutInflater().inflate(R.layout.custom_infowindow, null); 
     return v; 
    } 

    public View getInfoContents(Marker arg0) { 

     //View v = getLayoutInflater().inflate(R.layout.custom_infowindow, null); 

     return null; 

    } 
}); 

관련 문제