คอมโพเนนต์รายการสถานที่ขั้นสูง

คอมโพเนนต์รายการสถานที่ขั้นสูงช่วยให้คุณกำหนดและแสดงรายการสถานที่ได้ คุณแสดงสถานที่ได้สูงสุด 20 แห่งจากชุดข้อมูลระบุตัวตนเดียวกันที่คอมโพเนนต์รายละเอียดสถานที่รองรับ (รหัสสถานที่ ชื่อทรัพยากรของสถานที่ หรือพิกัดละติจูด/ลองจิจูด)

คุณเลือกได้ว่าจะแสดงรายการในแนวนอนหรือแนวตั้ง การวางแนวเริ่มต้นคือแนวตั้ง ข้อมูลและตัวเลือกการกำหนดค่าเดียวกันกับการ์ดรายละเอียดสถานที่แบบย่อและแบบเต็มจะพร้อมใช้งานสำหรับรายการแต่ละรายการ

ใช้ส่วนติดต่อ PlaceActionProvider ของ AdvancedPlaceListFragment เพื่อสร้างรายการ

การเรียกเก็บเงิน

ระบบจะเรียกเก็บเงินจากคุณสำหรับการขอรายการแต่ละครั้ง และการเปลี่ยนแปลงใดๆ ในรายการถือเป็นเหตุการณ์ใหม่ที่เรียกเก็บเงินได้

ตัวอย่าง

สร้าง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  

แสดงรายการสถานที่

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

ฟังผลลัพธ์

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)
    }
}