我使用接口 OnCheckedChangeListener,当点击 checbox 时 onCheckedChanged 方法被摧毁。
程序中有 10 个checkboxes。如何获取 CompoundButton 中点击的checkbox的名称?我觉得 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 in CompoundButton 的 key 名称?
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
buttonView
或者如何知道哪个已经被点击?