我正在开发一个应用,并且正在尝试使用自动完成片段搜索栏进行GoogleMaps活动以查找位置。
我尝试将PlaceAutocompleteFragment用于我的搜索栏片段,但IDE表示已弃用。我发现的唯一“解决方案”是使用SupportPlaceAutocompleteFragment而不是PlaceAutocompleteFragment。显然,这也是不推荐使用的,我根本没有避免这个问题。
SupportPlaceAutocompleteFragment autocompleteFragment = (SupportPlaceAutocompleteFragment)getactivity().getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
这是我的XML:
<fragment
android:id="@+id/place_autocomplete_fragment"
android:name="com.google.android.gms.location.places.ui.SupportPlaceAutocompleteFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
请帮助