我正在使用接口OnCheckedChangeListener
和onCheckedChanged
當我點擊checbox時會觸發該方法。Android從OnCheckedChangeListener的CompoundButton獲取CheckBox鍵名
但我有10個複選框。我如何獲得CompoundButton中點擊複選框的名稱。我認爲CompoundButton
擁有所有necesarry值,但我不知道如何得到這個值
例如:
<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" />
如何讓現在的關鍵名稱作爲CompoundButton
nm_mute_all_sounds
?
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
buttonView.
或者您如何知道我點擊了哪一個?
我看不到屬性Android這樣的:對於複選框或任何其他 – Pragnani
CompoundButton擁有所有我覺得值鍵,但我不能找到它 – senzacionale