1 回答

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超11個(gè)贊
我通過(guò)在每次文本更改為的參數(shù)時(shí)設(shè)置布局參數(shù)來(lái)修復(fù)它。editText
fun initTextWatcher(){
var tw: TextWatcher = object : TextWatcher {
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
val chat_textedit = viewOfLayout.chat_input_text
if (activity != null) {
activity?.runOnUiThread {
val lparams = chat_textedit.layoutParams as ConstraintLayout.LayoutParams
chat_textedit.layoutParams = lparams
}
}
}
override fun afterTextChanged(s: Editable) {}
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
}
viewOfLayout.chat_input_text.addTextChangedListener(tw)
}
添加回答
舉報(bào)