android-PlaceAutocompleteFragment单击消失

android-PlaceAutocompleteFragment单击消失,第1张

概述我想实现AutocompleteTextView(google地方),但是当我单击片段中的searchView时,该片段消失(向下滚动).我的代码:@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_a

我想实现autocompleteTextVIEw(Google地方),但是当我单击片段中的searchVIEw时,该片段消失(向下滚动).

我的代码:

 @OverrIDe    protected voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.activity_autocomplete);        PlaceautocompleteFragment autocompleteFragment = (PlaceautocompleteFragment) getFragmentManager().findFragmentByID(R.ID.place_autocomplete_fragment);        autocompleteFilter typeFilter = new autocompleteFilter.Builder()                .setTypeFilter(autocompleteFilter.TYPE_FILTER_CITIES)                .build();        autocompleteFragment.setFilter(typeFilter);        autocompleteFragment.setonPlaceSelectedListener(new PlaceSelectionListener() {            @OverrIDe            public voID onPlaceSelected(com.Google.androID.gms.location.places.Place place) {                // Todo: handle click            }            @OverrIDe            public voID one rror(Status status) {                // Todo: Handle the error.            }        });    }

XML:

<relativeLayout    xmlns:androID="http://schemas.androID.com/apk/res/androID"    xmlns:tools="http://schemas.androID.com/tools"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:orIEntation="vertical"    tools:context="ui.screen.activity.autocompleteActivity">    <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"/></relativeLayout>

感谢您的任何建议

解决方法:

我有同样的问题.我搞砸了API控制台
 https://console.developers.google.com/启用了AndroID的Maps API和Places API,现在一切正常.

总结

以上是内存溢出为你收集整理的android-PlaceAutocompleteFragment单击消失全部内容,希望文章能够帮你解决android-PlaceAutocompleteFragment单击消失所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1093853.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存