如何从Android中的PlaceAutocompleteFragment中删除搜索图标 [英] How to remove search icon from PlaceAutocompleteFragment in Android

查看:61
本文介绍了如何从Android中的PlaceAutocompleteFragment中删除搜索图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PlaceAutocompleteFragment搜索地点. 下面是我的xml代码

I am using PlaceAutocompleteFragment to search places. Below is my xml code

<fragment
android:id="@+id/place_source"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/colorPrimary"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment" />

我要删除默认情况下带有片段的搜索图标.

I want to remove search icon which by default comes with fragment.

推荐答案

您可以使用此行来获取搜索图标的引用:((View)findViewById(R.id.place_autocomplete_search_button)).setVisibility(View.GONE);

You can use this single line to get the reference of search icon :((View)findViewById(R.id.place_autocomplete_search_button)).setVisibility(View.GONE);

和此行以获取EditText的引用:((EditText)findViewById(R.id.place_autocomplete_search_input))

and this line to get the reference of EditText: ((EditText)findViewById(R.id.place_autocomplete_search_input))

这篇关于如何从Android中的PlaceAutocompleteFragment中删除搜索图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆