我正在尝试实现 place PlaceAutocompleteFragment,但问题是在单击搜索栏后 PlaceAutocompleteFragment 打开不到 1 秒。然后自动关闭。我也尝试使用 SupportPlaceAutocompleteFragment。这是我的代码
<fragment
android:id="@+id/place_autocomplete_fragment"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)
getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value=".........."/>
注意: 我在控制台中启用了地点搜索 API,还在我的项目中实现了地点和定位服务。
最佳答案
Android 版 Places SDK 引入了一个具有更新功能的全新静态库。适用于 Android 的 Places SDK 的 Google Play 服务版本(即 com.google.android.gms:play-services-places)已于 2019 年 1 月 29 日弃用,并将于 2019 年 7 月 29 日关闭。新版本Android 版 Places SDK 现在可用。
关于java - Android PlaceAutocompleteFragment自动关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58910619/