Custom info windows
をtutorialに設定しようとしています。ここでGoogleマップのカスタム情報ウィンドウを設定できません
は私のコードです:
public class MyActivity extends AppCompatActivity implements OnMapReadyCallback, ClickListenerChatFirebase, GoogleMap.InfoWindowAdapter {
public void showMap() {
venueMarker = mMap.addMarker(new MarkerOptions().position(new LatLng(Double.parseDouble(venueLat), Double.parseDouble(venueLng))).title(venue.trim()));
venueMarker.showInfoWindow();
getInfoWindow(venueMarker);
}
public AcceptedRequest(LayoutInflater inflater){
this.inflater = inflater;
}
@Override
public View getInfoWindow(Marker marker) {
// Getting view from the layout file
// inflater = getLayoutInflater();
View v = inflater.inflate(R.layout.venue_infowindow_background, null);
TextView title = (TextView) v.findViewById(R.id.venue_txt);
title.setText(marker.getTitle());
return v;
}
@Override
public View getInfoContents(Marker arg0) {
// TODO Auto-generated method stub
return null;
}
}
}
ここvenue_infowindow_background.xml
です:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:background="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/venue_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="venue"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="@android:color/white"/>
</LinearLayout>
問題は何の変化が起こっていないと、情報ウィンドウはデフォルトのテキスト色と背景色を示しているということです。
この問題のお手伝いをしてください。
これは仕事をしましたが、すべてのマーカーの背景とテキストカラーを変更しました...どのように1つのマーカーに対して変更できますか? –
'getInfoWindow()'オーバーライドを実装して、1つのマーカーのレイアウトを1つ増やし、他のすべてのマーカーのレイアウトを変更することができます。 –
ですがどうですか?少し熟考してください。 –