TextInputLayout:RuntimeException – 无法解析索引24处的属性

当我尝试在textInputLayout上设置textInputLayout时,我继续收到此错误:

 03-12 12:29:03.206 5706-5706/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.myapp, PID: 5706 java.lang.RuntimeException: Failed to resolve attribute at index 24 at android.content.res.TypedArray.getColor(TypedArray.java:401) at android.widget.TextView.(TextView.java:696) at android.widget.TextView.(TextView.java:632) at android.widget.TextView.(TextView.java:628) at android.widget.TextView.(TextView.java:624) at android.support.design.widget.TextInputLayout.setErrorEnabled(TextInputLayout.java:380) at com.bekwaai.popupwindow.RGNamePopUp$1.onClick(RGNamePopUp.java:48) at android.view.View.performClick(View.java:4780) at android.view.View$PerformClick.run(View.java:19866) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

这是场景 – 我在popupwindow有一个textInputLayout 。 这是popupwidow中的代码。

 public class NamePopUp extends PopupWindow { android.support.v7.widget.AppCompatEditText name; TextInputLayout nameInput; public NamePopUp(final Context context) { super(context); View popupView = LayoutInflater.from(context).inflate(R.layout.popup_rg_confirm, null); nameInput = (TextInputLayout) popupView.findViewById(R.id.name_input_layout); } } 

这是我popupwindow布局的xml:

    

这是我正在使用的风格:

   20sp @color/white  @color/white @color/white @color/white  

popup窗口在android.support.v4.app.Fragment调用,片段在AppCompatActivity

当用户单击“确定”按钮但名称edittext为空白时,会出现此错误。 换句话说,用户没有在edittext中输入任何内容并且单击了ok:

  button_ok.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (StringUtils.isNotEmpty(name.getText().toString())) { nameInput.setErrorEnabled(false); groupNameEvent.doEvent(name.getText().toString()); } else { nameInput.setErrorEnabled(true); //ERROR OCCURS HERE! nameInput.setError(context.getString(R.string.no_name)); } } }); 

如何让这个错误消失?