前几天我问,从光标填充。我最重视所有品牌的焦点。 但是现在我遇到了问题并填写了自定义视图,其中包含标题,描述以及纬度和经度。 它让我感到头脑,我试图看起来像是填充视线,但每一个都是这样。我不能够。 这是我的代码
info_windows_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#ffffff" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Esto es un titulo"
android:id="@+id/tv_title"
android:textStyle="bold"
android:textSize="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="tv_descripcion"
android:id="@+id/tv_descripcion"
android:textSize="16dp" />
<TextView
android:id="@+id/tv_lat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="lat" />
<TextView
android:id="@+id/tv_lng"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="lang" />
</LinearLayout>
CajerosMaps
public class CajerosMaps extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
Cursor cursor;
MiCajeroOperacional mb;
LatLngBounds.Builder builder;
CameraUpdate cu;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cajeros_maps);
mb = MiCajeroOperacional.getInstance(getApplicationContext());
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
cursor = mb.listar();
mMap = googleMap;
LatLng mark = null;
List<Marker> markersList = new ArrayList<Marker>();
int i = 0;
while (cursor.moveToNext()) {
double lat = cursor.getDouble(cursor.getColumnIndex("lat"));
double lng = cursor.getDouble(cursor.getColumnIndex("lng"));
mark = new LatLng(lat, lng);
Marker markCajero = mMap.addMarker(new MarkerOptions().position(mark).title("Sucursal Nº" + i).snippet(cursor.getString(cursor.getColumnIndex("direccion"))));
// mMap.moveCamera(CameraUpdateFactory.newLatLng(mark), 15);
markersList.add(markCajero);
i++;
}
cursor.close();
builder = new LatLngBounds.Builder();
for (Marker m : markersList) {
builder.include(m.getPosition());
}
int padding = 50;
LatLngBounds bounds = builder.build();
cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
mMap.moveCamera(cu);
}
}