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.
我一直在尝试扩展 ToggleButton 并尝试覆盖 setChecked 函数。
但是当我这样做时没有任何反应
@Override public void setChecked(boolean s) { super.setChecked(s); }
状态永远不会改变。
因为您调用super.setChecked(s);了覆盖,所以它仍然会执行超类(ToggleButton)中的现有代码。
super.setChecked(s);