在AutoCompleteTextView中,on focusChangeListener()showDropDown仅在Android Oreo设备中不起作用并显示错误消息" android.view.WindowManager $ BadTokenException:无法添加窗口 - 令牌android.os.BinderProxy @ f2a625f无效;你的活动在运行吗?"
googlePlaceAutocompleteAdapter = new googlePlaceAutocompleteAdapter(getApplicationContext(),android.R.layout.simple_list_item_1, this,list);
search_place.setAdapter(googlePlaceAutocompleteAdapter);
search_place.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
search_place.showDropDown();
}
}
});
search_place是我的autoCompleteTextView,我正在附加googlePlaceAutoCompleteAdapter。该列表包含我想在用户输入任何文本之前显示的位置。