editText.getText(). 片段中的追加不起作用
editText.getText().append in fragment is not working
我在适配器中使用自定义侦听器(用于 recyclerview)。如果单击视图,我会在片段中处理事件。
(事件是 editText.getText().append)
问题是我的自定义监听器运行良好,但我可以附加文本,当我使用 editText.getText 检查 edittext 时,没有任何东西...
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState){
final View root=inflater.inflate(R.layout.fragment,container,false)
editText=root.findViewById(R.Id.editText);
ad.setOnItenListener(new webTomainadaper.OnItemClickListener(){
public void OnItemClick(String s, int position){
editText.getText().append(s);
}
})}
使用
editText.setText().append(editText.getText().append(s));
您所做的只是请求 editText 中的文本,而不是更新视图 (editText)
我在适配器中使用自定义侦听器(用于 recyclerview)。如果单击视图,我会在片段中处理事件。 (事件是 editText.getText().append) 问题是我的自定义监听器运行良好,但我可以附加文本,当我使用 editText.getText 检查 edittext 时,没有任何东西...
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState){
final View root=inflater.inflate(R.layout.fragment,container,false)
editText=root.findViewById(R.Id.editText);
ad.setOnItenListener(new webTomainadaper.OnItemClickListener(){
public void OnItemClick(String s, int position){
editText.getText().append(s);
}
})}
使用
editText.setText().append(editText.getText().append(s));
您所做的只是请求 editText 中的文本,而不是更新视图 (editText)