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

Rit*_*esh 4 android google-places-api

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

<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" />
Run Code Online (Sandbox Code Playgroud)

我想删除默认带有片段的搜索图标.

截图

raj*_*t44 9

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

这行来获取EditText的引用: ((EditText)findViewById(R.id.place_autocomplete_search_input))