我正在使用界面OnCheckedChangeListener
,onCheckedChanged
当我单击复选框时会触发方法。
但我有 10 个复选框。如何获取 CompoundButton 中单击的复选框的名称。我认为这CompoundButton
有所有必要的价值,但我不知道如何获得这个价值
例如:
<CheckBox
android:id="@+id/cb_mute_all_sounds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:key="nm_mute_all_sounds" />
nm_mute_all_sounds
现在如何获取密钥名称CompoundButton
?
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
buttonView.
或者你怎么知道我点击了哪个?