如何从Android中的PlaceAutocompleteFragment中删除搜索图标

如何从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))