2014-04-17 2 views
1

클릭하면 팽창 된 레이아웃이 GeoPoint에 대한 세부 정보와 함께 표시 될 때마다 GeoPoint가 있습니다. 처음에는 풍선 레이아웃 안에 버튼이 있었지만 지금은 발견했습니다 :팽창 된 레이아웃에서 onClick 이벤트를 생성합니다.

뷰는 반환 될 때 View.draw (Canvas)를 사용하여 이미지로 렌더링됩니다. 따라서 전체 확장 된 레이아웃에 대해 onclick 이벤트를 만들 수 있습니다.

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
android:minWidth="150dp" 
android:id="@+id/placeInfo" 
> 
<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/txtName" 
    android:textColor="#ff555555" 
    android:textSize="14dip" 
    android:textStyle="bold" 
    android:layout_marginTop="5dip" 
    /> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/txtHours" 
    android:textColor="#ff555555" 
    android:textSize="14dip" 
    android:layout_marginTop="5dip" 
    /> 
<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/txtCountry" 
    android:textColor="#ff555555" 
    android:textSize="14dip" 
    android:layout_marginTop="5dip" 
    /> 
<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/txtAddress" 
    android:textColor="#ff555555" 
    android:textSize="14dip" 
    android:layout_marginTop="5dip" 
    /> 
<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/txtPostCode" 
    android:textColor="#ff555555" 
    android:textSize="14dip" 
    android:layout_marginTop="5dip" 
    /> 

답변

0

지금 당신이 팽창 레이아웃 내의 특정 요소를 선택할 수 없습니다 당신이 전체를 선택해야이 문제에 대한 해결책을 발견 : 다음은 팽창 레이아웃에 대한 XML 파일을 보여줍니다 부풀어 오른 레이아웃. 이 작업은 다음 코드 행을 통해 수행됩니다.

googleMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() { 
    @Override 
    public void onInfoWindowClick(Marker marker) { 

    } 
}); 
관련 문제