0
InfoWindow에 현재 위치와 장소 이름을 표시하는 Google지도가 있습니다. 잘 작동하지만 문제는 장소 이름이 너무 길어서 그 때 전체 텍스트가 this처럼 InfoWindow에 제대로 표시되지 않는 경우입니다. 이 Infowindow의 크기를 조정하려면 어떻게해야합니까? 내 코드는 다음과 같습니다 :Infowindow의 높이 조절
private class CustomInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {
private View view;
public CustomInfoWindowAdapter() {
view = getLayoutInflater().inflate(R.layout.info_window, null);
view.setLayoutParams(new RelativeLayout.LayoutParams(500, RelativeLayout.LayoutParams.WRAP_CONTENT));
}
@Override
public View getInfoContents(Marker marker) {
if (CheckIn.this.marker != null && CheckIn.this.marker.isInfoWindowShown()) {
CheckIn.this.marker.hideInfoWindow();
CheckIn.this.marker.showInfoWindow();
}
return null;
}
@Override
public View getInfoWindow(final Marker marker) {
CheckIn.this.marker = marker;
String url = null, isLoaded = "0";
/*if (marker.getId() != null && markers != null && markers.size() > 0) {
if (markers.get(marker.getId()) != null && markers.get(marker.getId()) != null) {
url = markers.get(marker.getId());
isLoaded = markers.get(marker.getId() + marker.getTitle());
}
}*/
final ImageView imgAddress = ((ImageView) view.findViewById(R.id.imgAddress));
final String title = marker.getTitle();
final CustomTextView txtTitle = ((CustomTextView) view.findViewById(R.id.txtTitle));
if (title != null) {
/*txtTitle.setText("La Brasserie Bordelaise");*/
mProgressDialog.dismiss();
txtTitle.setText(currentPlaceName);
txtTitle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(CheckIn.this, title, Toast.LENGTH_LONG).show();
}
});
} else {
txtTitle.setText("");
}
return view;
}
}
내 XML 당신은 전체 레이아웃에 대한 고정 폭을 설정 한
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:customFont="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="@dimen/margin_120"
android:layout_centerHorizontal="true"
android:layout_marginLeft="@dimen/margin_30"
android:layout_marginRight="@dimen/margin_30"
android:background="@drawable/bg_info_window">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_5">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="@dimen/margin_5"
android:layout_marginRight="@dimen/margin_5"
android:layout_toLeftOf="@+id/imgAddress">
<com.widget.CustomTextView
android:id="@+id/txtTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:inputType="textMultiLine"
android:maxLines="2"
android:singleLine="false"
android:text="aaaa"
android:textColor="@android:color/black"
android:textSize="@dimen/text_size_16"
customFont:fontTextStyle="3" />
<!--android:text="La Brasserie Bordelaise"-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txtTitle"
android:layout_marginLeft="@dimen/margin_5"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_5"
android:src="@drawable/ic_person" />
<com.widget.CustomTextView
android:id="@+id/txtTotalPeople"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:inputType="textMultiLine"
android:singleLine="false"
android:text="aaaa"
android:textColor="@color/colorDetailGray"
android:textSize="@dimen/text_size_medium"
customFont:fontTextStyle="3" />
</LinearLayout>
</RelativeLayout>
<ImageView
android:id="@+id/imgAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:contentDescription="@string/app_name"
android:padding="@dimen/padding_10"
android:src="@drawable/ic_right_arrow" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
죄송합니다. 그것은 나를 위해 일하지 않는다! !! –
내 info_window 레이아웃에 2 개의 TextView가 포함되어 있으므로 InfoWindow에서 두 번째 텍스트 뷰가 나타납니다! –
지금 시도 할 수 없으므로 이미지를 게시 할 수 있습니까? 화면을 게시하고 ID를 기재하십시오. –