רכיב ההשלמה האוטומטית הבסיסי של המקומות בערכת כלי ה-UI של Places מאפשר להוסיף רכיב UI יחיד שמחזיר מזהה מקום כשמשתמש בוחר מקום. הרכיב הוא כיסוי מסך מלא שמספק סרגל חיפוש שבו המשתמשים יכולים להזין שאילתה. בזמן שהמשתמש מקליד, רשימה של תוצאות השלמה אוטומטית מוצגת מתחת לסרגל החיפוש. כשהמשתמש מקיש על מקום, מוחזר למפתח אובייקט של מקום עם מזהה המקום בלבד. אפשר להתאים אישית את הרכיב הזה.
לרכיב 'השלמה אוטומטית בסיסית של מקומות' יש את אפשרויות ההתאמה האישית הבאות: צפיפות הרשימה והאם לכלול סמלי מיקום. כדי להתאים אישית את הרכיב, משתמשים ב-AutocompleteUICustomization.
אפשר להשתמש ברכיב 'השלמה אוטומטית בסיסית של מקומות' באופן עצמאי או בשילוב עם ממשקי API ושירותים אחרים של Google Maps Platform.
חיוב
החיוב מתבצע בכל פעם שהרכיב נפתח ומתבצעת שאילתה. לא תחויבו שוב על הפעילות הזו אלא אם פג תוקף הפעילות או אם בחרתם מקום מהרשימה.
הוספת הרכיב Basic Autocomplete לאפליקציה
מגדירים את פרמטרי הסינון של ההשלמה האוטומטית (לדוגמה, הסוגים להחזרה, המדינה להגבלת התוצאות, קואורדינטות האזור לתוצאות, המקור של הבקשה להצגת פרטי המרחק, אם זמינים) כמו שמגדירים כשמשתמשים בהשלמה אוטומטית של מקומות (חדש) בלי ערכת כלי ה-UI של Places. הוראות מלאות ודוגמה לקוד ליצירת מסנן השלמה אוטומטית זמינות במסמכי התיעוד בנושא השלמה אוטומטית של מקומות (חדש).
אפשר לבחור להציג רשימה עם שתי שורות או רשימה עם כמה שורות. משתמשים באפשרויות ב-AutocompleteListDensity (TWO_LINE או MULTI_LINE) במחלקה AutocompleteUICustomization. אם לא מציינים את צפיפות הרשימה, הרכיב יציג רשימה של שתי שורות.
סמל המיקום
אתם יכולים לבחור אם להציג סמל ברירת מחדל של מקום ברשימת התוצאות. משתמשים באפשרויות ב-AutocompleteUIIcon (listItemDefaultIcon או noIcon) במחלקה AutocompleteUICustomization.
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2025-09-04 (שעון UTC)."],[],[],null,["Select platform: [Android](/maps/documentation/places/android-sdk/basic-place-autocomplete-ui-kit \"View this page for the Android platform docs.\") [iOS](/maps/documentation/places/ios-sdk/basic-place-autocomplete-ui-kit \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/places-ui-kit/basic-autocomplete \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nBasic Place Autocomplete component\n==================================\n\n\nThe Basic Place Autocomplete component of the Places UI Kit lets you add an individual UI component that returns a [place ID](/maps/documentation/places/android-sdk/place-id) when a user selects a place. The component is a full screen cover that provides a search bar for users to enter a query. As the user types, a list of autocomplete results will be shown below the search bar. When the user taps on a place, a place object with only place ID is returned to the developer. This component is customizable.\n\n\nThe Basic Place Autocomplete component has the following customization options: list density, and whether to include location icons. Use [`AutocompleteUICustomization`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/widget/model/AutocompleteUiCustomization) to customize the component.\n\n\nYou can use the Basic Place Autocomplete component independently or in conjunction with other Google Maps Platform APIs and services.\n\nBilling\n-------\n\n\nYou are billed each time the component is opened and a query is made. You won't be billed again for that session unless the session expires or a place is selected from the list.\n\nAdd the Basic Autocomplete component to your app\n------------------------------------------------\n\n\nSet the autocomplete filter parameters (for example, the types to return, the country to limit results to, the region coordinates for results, the origin of the request to display distance information, if available) as you would to use Place Autocomplete (New) without the Places UI Kit. See the [Place Autocomplete (New) documentation](/maps/documentation/places/android-sdk/place-autocomplete) for full instructions and [an example of the code to create an autocomplete filter](/maps/documentation/places/android-sdk/place-autocomplete#optional-parameters).\n\n\nOnce you've created your autocomplete filter, add your UI customizations. [See customization options and instructions.](/maps/documentation/places/android-sdk/basic-place-autocomplete#customize-the-basic-autocomplete-component) \n\n### Kotlin\n\n```kotlin\nAutocompleteUiCustomization.create(\n listDensity = AutocompleteListDensity.MULTI_LINE,\n listItemIcon = AutocompleteUiIcon.noIcon(),\n)\n```\n\n### Java\n\n```java\n \nAutocompleteUiCustomization.builder()\n .listItemIcon(AutocompleteUiIcon.noIcon())\n .listDensity(AutocompleteListDensity.MULTI_LINE)\n .build()\n```\n\n\n[See the full example](/maps/documentation/places/android-sdk/basic-place-autocomplete-ui-kit#example).\n\nCustomize the Basic Autocomplete component\n------------------------------------------\n\n### List density\n\n\nYou can choose to either display a two-line list or a multiline list. Use the options in `AutocompleteListDensity` (`TWO_LINE` or `MULTI_LINE`) in the [`AutocompleteUICustomization`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/widget/model/AutocompleteUiCustomization) class. If you don't specify the list density, the component will display a two-line list.\n\n### Location icon\n\n\nYou can choose whether to display a default place icon on the results list. Use the options in `AutocompleteUIIcon` (`listItemDefaultIcon` or `noIcon`) in the [`AutocompleteUICustomization`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/widget/model/AutocompleteUiCustomization) class.\n\n### Add customizations to the Basic Autocomplete component\n\n\nUse the [`AutocompleteUICustomization`](/maps/documentation/places/android-sdk/reference/com/google/android/libraries/places/widget/model/AutocompleteUiCustomization) class to customize the Basic Autocomplete component. \n\n### Kotlin\n\n```kotlin\n.setAutocompleteUiCustomization(\n AutocompleteUiCustomization.create(\n listDensity = AutocompleteListDensity.MULTI_LINE,\n listItemIcon = AutocompleteUiIcon.noIcon(),\n )\n)\n```\n\n### Java\n\n```java\n.setAutocompleteUiCustomization(\n AutocompleteUiCustomization.builder()\n .listItemIcon(AutocompleteUiIcon.noIcon())\n .listDensity(AutocompleteListDensity.MULTI_LINE)\n .build()\n)\n```\n\nExample\n-------\n\n\nThis example creates a custom Basic Autocomplete component. \n\n### Kotlin\n\n```kotlin\n val basicPlaceAutocompleteActivityResultLauncher:\n ActivityResultLauncher\u003cIntent\u003e =\n registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {\n result: ActivityResult -\u003e\n val intent = result.data\n val place: Place? = BasicPlaceAutocomplete.getPlaceFromIntent(intent!!)\n val status: Status? = \n BasicPlaceAutocomplete.getResultStatusFromIntent(intent!!)\n // ...\n }\n \n val autocompleteIntent: Intent =\n BasicPlaceAutocomplete.createIntent(this) {\n setInitialQuery(\"INSERT_QUERY_TEXT\")\n setOrigin(LatLng(10.0, 10.0))\n // ...\n \n setAutocompleteUiCustomization(\n AutocompleteUiCustomization.create(\n listDensity = AutocompleteListDensity.MULTI_LINE,\n listItemIcon = AutocompleteUiIcon.noIcon(),\n )\n )\n }\n \n basicPlaceAutocompleteActivityResultLauncher.launch(autocompleteIntent)\n```\n\n### Java\n\n```java\n ActivityResultLauncher\u003cIntent\u003e basicPlaceAutocompleteActivityResultLauncher =\n registerForActivityResult(\n new ActivityResultContracts.StartActivityForResult(),\n new ActivityResultCallback\u003cActivityResult\u003e() {\n @Override\n public void onActivityResult(ActivityResult result) {\n Intent intent = result.getData();\n if (intent != null) {\n Place place =\n BasicPlaceAutocomplete.getPlaceFromIntent(intent);\n Status status =\n BasicPlaceAutocomplete.getResultStatusFromIntent(intent);\n //...\n }\n }\n }\n );\n \n Intent basicPlaceAutocompleteIntent =\n new BasicPlaceAutocomplete.IntentBuilder()\n .setInitialQuery(\"INSERT_QUERY_TEXT\")\n .setOrigin(new LatLng(10.0, 10.0))\n //...\n \n .setAutocompleteUiCustomization(\n AutocompleteUiCustomization.builder()\n .listItemIcon(AutocompleteUiIcon.noIcon())\n .listDensity(AutocompleteListDensity.MULTI_LINE)\n .build())\n .build(this);\n \n basicPlaceAutocompleteActivityResultLauncher.launch(basicPlaceAutocompleteIntent);\n```"]]