Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
键入内容时,我需要捕捉 EditText 的 TextChange 事件。但是当我在活动代码中更改 EditText 的值时,我不希望它被触发。
我能做什么?
private boolean listenForChanges = true; ... @Override public void afterTextChanged(Editable s) { if( listenForChanges ) { // Process edits here } } ... listenForChanges = false; myEditText.setText( "Some text" ); listenForChanges = true;