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将被一一删除。但我不知道如何为此编写代码。请提出解决方案?
EditText
像这样的东西应该工作:
EditText edit; ... String txt = edit.getText(); txt = txt.length() > 1 ? txt.substring(0, txt.length() - 2) : "0"; edit.setText(txt);