Android studio FloatingEditText类.exception

Android studio FloatingEditText类.exception,android-studio,android-edittext,classcastexception,Android Studio,Android Edittext,Classcastexception,我是安卓工作室的新手。我已经稍微改变了我的应用程序,加入了marvinlabs的浮动文本编辑小部件 该小部件工作正常,并按预期工作,但当我单击“计算”按钮时,它会告诉我应用程序已停止工作,我在logcat错误中得到以下信息: Caused by: java.lang.ClassCastException: com.marvinlabs.widget.floatinglabel.edittext.FloatingLabelEditText cannot be cast to android.wid

我是安卓工作室的新手。我已经稍微改变了我的应用程序,加入了marvinlabs的浮动文本编辑小部件

该小部件工作正常,并按预期工作,但当我单击“计算”按钮时,它会告诉我应用程序已停止工作,我在logcat错误中得到以下信息:

Caused by: java.lang.ClassCastException: com.marvinlabs.widget.floatinglabel.edittext.FloatingLabelEditText cannot be cast to android.widget.EditText
            at com.motionnetworkz.bonus.BonusCalc.onCalcClick(BonusCalc.java:29)
代码行是:

EditText a1 = (EditText) findViewById(R.id.TFSalary);
        String strTFSalary = a1.getText().toString();
        if (TextUtils.isEmpty(strTFSalary)) {
            a1.setError("No Salary Value");
我把它改成了

com.marvinlabs.widget.floatinglabel.edittext.FloatingLabelEditText a1=(com.marvinlabs.widget.floatinglabel.edittext.FloatingLabelEditText)findViewById(R.id.tf);
字符串strTFSalary=a1.getText().toString();
if(TextUtils.isEmpty(strTFSalary)){
a1.设置错误(“无工资值”);

因为这是xml文件(was EditText)中所称的,但随后会引发其他错误

a1.gettext
&
a1.setError
则成为
无法解析方法gettext()的错误

我做错了什么?

解决了

FloatingLabelEditText a1=(FloatingLabelEditText)findViewById(R.id.TFSalary);
字符串strTFSalary=a1.getInputWidgetText().toString();

我不需要设置整个
com.marvinlabs…
部分,只需设置
FloatingLabelEditText

然后将
getText()
更改为
getInputWidgetText()

Android studio运行得非常慢,从来没有给我任何添加选项。重新启动后,它就清除了,并给了我一个选项列表。反复试验,一切正常