Java android AutoCompleteTextview采用html格式设计,无需自定义类

Java android AutoCompleteTextview采用html格式设计,无需自定义类,java,android,html,tostring,autocompletetextview,Java,Android,Html,Tostring,Autocompletetextview,我在string.xml中用html格式设计文本视图,这对我来说很有用, 当我试图通过ArrayAdapter将此应用于自动完成时,它不起作用:( 有人有办法吗 //学生类toString()重写 //活动中AutoCompleteTextView的初始化适配器 public void second(ArrayList<Student> list) { Student.context = this; ArrayAdapter<Student> adapte

我在string.xml中用html格式设计文本视图,这对我来说很有用,

当我试图通过ArrayAdapter将此应用于自动完成时,它不起作用:(
有人有办法吗

//学生类toString()重写

//活动中AutoCompleteTextView的初始化适配器

public void second(ArrayList<Student> list) {
    Student.context = this;
    ArrayAdapter<Student> adapter = new ArrayAdapter<Student>(this,
            R.layout.my_textview, list);
    AutoCompleteTextView completeTextView = (AutoCompleteTextView) findViewById(R.id.students);
    completeTextView.setAdapter(adapter);
}
public void second(数组列表){
Student.context=this;
ArrayAdapter=新的ArrayAdapter(此,
R.layout.my_文本视图,列表);
AutoCompleteTextView completeTextView=(AutoCompleteTextView)findViewById(R.id.students);
setAdapter(适配器);
}
//string.xml

<string name="welcome_messages">Hello, %1$s! You have &lt;b>%2$s new messages&lt;/b>.</string>
您好,%1$s!您有b>%2$s条新消息/b>。

“当我试图通过ArrayAdapter将此应用于autoComplete时,它不起作用”-如何,确切地说?崩溃?堆栈跟踪?您在哪个类中重写
toString
方法?文本与默认文本一样正常,没有任何设计I在学生类中重写需要转换为字符串-“类型不匹配:无法从CharSequence转换为String”当我转换时,它根本不起作用
<string name="welcome_messages">Hello, %1$s! You have &lt;b>%2$s new messages&lt;/b>.</string>