Tema: [ CONSULTA ] Mapas en Android
Ver Mensaje Individual
  #3  
Viejo 02/07/13, 11:31:42
Array

[xs_avatar]
antmon12 antmon12 no está en línea
Usuario novato en la web
 
Fecha de registro: ene 2013
Mensajes: 29
Tu operador: Movistar

Pongo código y así despejamos dudas:

Código:
<!-- Layout principal --> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#585858"
        android:choiceMode="singleChoice" />
</android.support.v4.widget.DrawerLayout>
Código:
//Actividad principal
public class MainActivity extends Activity implements OnItemClickListener {

    // Variables miembro.
    private Fragment mContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
		if (mContent == null)
			mContent = new Fragment_localizacion();
        
        getFragmentManager()
		.beginTransaction()
		.replace(R.id.content_frame, mContent).commit();
......
Código:
//Fragment del mapa
public class Fragment_localizacion extends FragmentActivity {

	private GoogleMap mapa;

	 @Override
	 protected void onCreate(Bundle savedInstanceState) {
		 super.onCreate(savedInstanceState);
		 setContentView(R.layout.mi_localizacion);
		 mapa = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
		 mapa.setMapType(GoogleMap.MAP_TYPE_NORMAL);
		 mapa.setMyLocationEnabled(true);
		 mapa.getUiSettings().setZoomControlsEnabled(false);
		 mapa.getUiSettings().setCompassEnabled(true);
		 mapa.getMyLocation();
}

Última edición por antmon12 Día 02/07/13 a las 11:35:54.
Responder Con Cita