当我编译代码A时,我得到一个错误,系统提示我存在一个方法名称setEditText
.
但是fun setIsShowEditDialog(isShow:Boolean)
没有提示就可以存在一个方法名setIsShowEditDialog
,为什么?
我得把fun setEditText(input:String)
改成fun set_EditText(input:String)
,编译就可以了.
但Android Studio提示我一条警告信息:Function name 'set_EditText' should not contain underscores,为什么?
Code A个
class EditDialogState private constructor(context: Context) {
var isShowEditDialog by mutableStateOf(false)
private set
var editText by mutableStateOf("")
private set
fun setIsShowEditDialog(isShow:Boolean) { //It's OK
isShowEditDialog = isShow
}
fun setEditText(input:String) { //Compile Error
editText = input
}
}