我正在使用片段,我想註冊一個按鈕單擊,但當我嘗試使用android:onClick時出現此錯誤。片段中的按鈕點擊
java.lang.IllegalStateException: Could not find method preferenceChange(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'btnSave'
我試着尋找不同的解決方案,但沒有任何工作。我沒有運行Lolipop。
你在哪裏做btnSave功能? – yanivtwin
在名爲PreferencesView.java的片段中 – Coder
您可以發佈完整的片段和活動代碼嗎? –