我正在开发一个应用,其中我使用搜索视图从Google Places api搜索自动填充功能中的地址,然后选择一个但“由Google强力驱动”的徽标始终出现在自动填充容器的底部,我想删除
放置自动完成活动
public class Places Autocomplete Activity extends AppCompatActivity {
@BindView(R.id.autocomplete)
PlacesAutocompleteTextView mAutocomplete;
@BindView(R.id.street)
TextView mStreet;
@BindView(R.id.city)
TextView mCity;
@BindView(R.id.state)
TextView mState;
@BindView(R.id.zip)
TextView mZip;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_places_autocomplete);
ButterKnife.bind(this);
mAutocomplete.setOnPlaceSelectedListener(new OnPlaceSelectedListener() {
@Override
public void onPlaceSelected(final Place place) {
mAutocomplete.getDetailsFor(place, new DetailsCallback() {
@Override
public void onSuccess(final PlaceDetails details) {
Log.d("test", "details " + details);
mStreet.setText(details.name);
for (AddressComponent component : details.address_components) {
for (AddressComponentType type : component.types) {
switch (type) {
case STREET_NUMBER:
break;
case ROUTE:
break;
case NEIGHBORHOOD:
break;
case SUBLOCALITY_LEVEL_1:
break;
case SUBLOCALITY:
break;
case LOCALITY:
mCity.setText(component.long_name);
break;
case ADMINISTRATIVE_AREA_LEVEL_1:
mState.setText(component.short_name);
break;
case ADMINISTRATIVE_AREA_LEVEL_2:
break;
case COUNTRY:
break;
case POSTAL_CODE:
mZip.setText(component.long_name);
break;
case POLITICAL:
break;
}
}
}
}
@Override
public void onFailure(final Throwable failure) {
Log.d("test", "failure " + failure);
}
});
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_hide_x) {
mAutocomplete.showClearButton(false);
}
if (id == R.id.action_show_x) {
mAutocomplete.showClearButton(true);
}
return super.onOptionsItemSelected(item);
}
这是搜索视图活动的代码