1 回答
TA贡献1818条经验 获得超11个赞
我通过在每次文本更改为的参数时设置布局参数来修复它。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)
}
添加回答
举报