Android setError在弹出按钮中显示文本,而不是在编辑文本下方

Android setError在弹出按钮中显示文本,而不是在编辑文本下方,android,textinputlayout,android-textinputedittext,Android,Textinputlayout,Android Textinputedittext,下面我将显示错误并实现它。它工作得很好,但是我没有在编辑文本下面显示错误,而是让它们在上面浮动,并带有警告图标 @颜色/口音 12dp txtPhoneNumber.setError(“无效格式”); 我如何才能使错误显示在编辑文本下方?您应该在那里传递对象 <android.support.design.widget.TextInputLayout android:id="@+id/txtLayout"> ......... </androi

下面我将显示错误并实现它。它工作得很好,但是我没有在编辑文本下面显示错误,而是让它们在上面浮动,并带有警告图标


@颜色/口音
12dp
txtPhoneNumber.setError(“无效格式”);
我如何才能使错误显示在编辑文本下方?

您应该在那里传递对象

  <android.support.design.widget.TextInputLayout
   android:id="@+id/txtLayout">
   .........    
</android.support.design.widget.TextInputLayout>

哦,我应该使用布局,而不是编辑文本,cool@AlexeyStrakh对使用
TextInputLayout
代替
textInputItemText
  <android.support.design.widget.TextInputLayout
   android:id="@+id/txtLayout">
   .........    
</android.support.design.widget.TextInputLayout>
  txtLayoutOBJ.setError("Invalid Format");
TextInputLayout til = (TextInputLayout)findViewById(R.id.text_input_layout)
til.setError("Your Error");