0
我的自定義視圖中存在包含edittext和微調框的問題。我已經使用IMEoptions添加了「下一個」按鈕。根據微調,edittext鍵盤應該包含「下一個」或「完成」鍵。Android動態更改軟鍵盤中的按鍵
目前,我解決這個使用:
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
final Object item = adapterView.getItemAtPosition(position);
if (item.equals(getString(STRING1))) {
edittext.setImeOptions(EditOptions.IME_OPTIONS_NEXT);
} else if(item.equals(getString(STRING2)){
edittext.setImeOptions(EditOptions.IME_OPTIONS_ACTION_DONE);
}
edittext.setText(edittext.getText());
//This updates the edittext but is very much an ugly hack.
//Is there another way to update this? invalidate() and forceLayout()
//does not do the trick
}