0
尝试将事件侦听器连接到Android studio中的EditText字段,并且即时通讯会引发错误。这里是我的事件侦听器:无法解析符号SetOnEditorActionListener
TextView editText = new TextView (this);
editText.setOnEditorActionListener (new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event){
if (actionId == EditorInfo.IME_ACTION_DONE)
{
//Write what you want to achieve
}
return false;
}
});
,这里是我的EditText上的xml:
<EditText
android:id="@+id/etValue"
android:singleLine="true"
android:imeOptions="actionDone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="numberPassword"
android:password="true"
android:textAlignment="center"
android:layout_marginTop="84dp"
android:layout_below="@+id/textView"
android:layout_alignLeft="@+id/textView"
android:layout_alignStart="@+id/textView"
android:layout_alignRight="@+id/textView"
android:layout_alignEnd="@+id/textView" />
我已经试过进口widget.TextView.OnEditorActionListener而Android工作室仍然说,setOnEditorActionListener符号无法解析。
任何人有任何想法?