【发布时间】:2020-03-15 14:54:18
【问题描述】:
我不想setText("") 清除文本。
我想模拟右十字图标的点击动作。
怎么做?
【问题讨论】:
标签: android android-textinputedittext autocompletesupportfragment
我不想setText("") 清除文本。
我想模拟右十字图标的点击动作。
怎么做?
【问题讨论】:
标签: android android-textinputedittext autocompletesupportfragment
基于the implementation of that icon,在TextInputEditText上调用setText(null)。
【讨论】:
用途:
if (editText != null) {
editText.getText().clear();
}
【讨论】:
(使用 Kotlin)
[your ID right cross icon].setOnClickListener {
[your ID edit text].text.clear()
}
【讨论】:
(AutocompleteSupportFragment)
getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment).setText(null)
它将完全按照清除图标的作用。
【讨论】: