如何将错误文本消息对齐到edittext的中心和下方。我尝试对齐但它不起作用。这是我的代码:
xml
<android.support.design.widget.TextInputLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tilEmail">
<EditText
android:layout_width="match_parent"
android:id="@+id/mob"
android:layout_height="35dp"
android:background="@drawable/round_corner_3"
android:inputType="phone"
android:hint="Mobile Number"
android:textColorHint="@color/colorGray"
android:textColor="@color/Black"
android:drawablePadding="10dp"/>
</android.support.design.widget.TextInputLayout>
Java 类
til = (TextInputLayout) findViewById(R.id.tilEmail);
til.setError("Mobile number not valid");
til.setError(Html.fromHtml("<font color='red'>Mobile number not valid</font>"));
mobile.setError(null);
mobile.getBackground().setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
Toast.makeText(getApplicationContext(), "Phone number or Password is not valid", Toast.LENGTH_SHORT).show();
}