Fanidan 4-amaliy mashg’ulot


Download 1.54 Mb.
Sana17.06.2023
Hajmi1.54 Mb.
#1520968
Bog'liq
4-amaliy. Mobile


316-20 guruh talabasi
Burxonov Karomatillo
Mobil ilovalarni ishlab chiqish fanidan
4-amaliy mashg’ulot
Sayohat ilovasi: Bu mehmonxona qidirish va bron qilish ilovasi, marshrutni rejalashtirish ilovasi, mahalliy restoran qidiruvi ilovasi va boshqalar boʻlishi mumkin.





git clone https://github.com/googlecodelabs/maps-platform-101-android.git
android:name="com.google.android.gms.maps.SupportMapFragment"

xmlns:app="http://schemas.android.com/apk/res-auto">
android:id="@+id/normal_map"
android:title="@string/normal_map"
app:showAsAction="never" />
android:id="@+id/hybrid_map"
android:title="@string/hybrid_map"
app:showAsAction="never" />
android:id="@+id/satellite_map"
android:title="@string/satellite_map"
app:showAsAction="never" />
android:id="@+id/terrain_map"
android:title="@string/terrain_map"
app:showAsAction="never" />




  1. In strings.xml, add resources for the title attributes in order to resolve the errors.


...
Normal Map
Hybrid Map
Satellite Map
Terrain Map
Lat: %1$.5f, Long: %2$.5f
Dropped Pin
poi




  1. In MapsActivity, override the onCreateOptionsMenu() method and inflate the menu from the map_options resource file.

override fun onCreateOptionsMenu(menu: Menu?): Boolean {
val inflater = menuInflater
inflater.inflate(R.menu.map_options, menu)
return true
}



  1. In MapsActivity.kt, override the onOptionsItemSelected() method. Change the map type using map-type constants to reflect the user's selection.

override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) {
// Change the map type based on the user's selection.
R.id.normal_map -> {
map.mapType = GoogleMap.MAP_TYPE_NORMAL
true
}
R.id.hybrid_map -> {
map.mapType = GoogleMap.MAP_TYPE_HYBRID
true
}
R.id.satellite_map -> {
map.mapType = GoogleMap.MAP_TYPE_SATELLITE
true
}
R.id.terrain_map -> {
map.mapType = GoogleMap.MAP_TYPE_TERRAIN
true
}
else -> super.onOptionsItemSelected(item)
}
Download 1.54 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling