Componente Advanced Place List
Il componente Elenco avanzato di luoghi ti consente di definire e visualizzare un elenco di luoghi. Puoi elencare fino a 20 luoghi dello stesso insieme di identità supportate dal componente Dettagli luogo (ID luogo, nomi delle risorse luogo o coordinate di latitudine/longitudine).
Puoi scegliere tra una visualizzazione orizzontale o verticale dell'elenco. L'orientamento predefinito è verticale. Per ogni elemento dell'elenco sono disponibili le stesse informazioni e opzioni di configurazione delle schede compatte e complete dei dettagli del luogo.
Utilizza l'interfaccia PlaceActionProvider di AdvancedPlaceListFragment per creare un elenco.
Fatturazione
Ti viene addebitato un costo per ogni richiesta di elenco e qualsiasi modifica all'elenco è un nuovo evento fatturabile.
Esempio
Creare un frammento AdvancedPlaceList
Kotlin
// Initialize first Places.initializeWithNewPlacesApiEnabled(context, API_KEY) // how fragment is created AdvancedPlaceListFragment.newInstance( selectedContent, orientation, R.style.BrandedPlaceDetailsTheme, ) // fragments support the same configurations that PlaceSearchFragment supports fragment.preferTruncation = false fragment.attributionPosition = AttributionPosition.BOTTOM fragment.mediaSize = AdvancedPlaceListFragment.MediaSize.SMALL fragment.selectable = true
Mostrare un elenco di luoghi
Kotlin
// You can use resourceNames or placeIds advancedPlaceListFragment.configureFromPlaceIds(placeIds) advancedPlaceListFragment.configureFromResourceNames(resourceNames) // Alternatively, use coordinates, which are a list of LatLng: advancedPlaceListFragment.configureFromCoordinates(coordinates) // Uses reverse geocoding to get the place
Ascoltare i risultati
Kotlin
// Attach the existing PlaceSearchFragmentListener to get notified when places load or are selected from the results list. override fun onAttachFragment(fragment: Fragment) { super.onAttachFragment(fragment) when (fragment) { // Reuse the placeSearchFragmetnListener from the Essentials version is AdvancedPlaceSearchFragment -> fragment.registerListener(placeSearchFragmentListener) // Use placeListFragmentListener, it's functionally identical but with a new name. is AdvancedPlaceListFragment -> fragment.registerListener(advancedPlaceListFragmentListener) } }