Ich benutze Appcompact Edittext mit TextInput-Layout. Wenn ich Fehler auf editedtext setze, zeigt es Fehlersymbol in der Mitte von editedtext anstelle von Ende wie unten Bild an.TextInput-Layout show edittext Fehlersymbol in der Mitte in API17
Wenn ich Texteingabe-Layout von Layout XML entfernen, dann zeigen Sie es Symbol an richtigen Platz.
BEARBEITEN Meine Layout-XML wie unten.
<ScrollView
android:layout_width="fill_parent"
android:fitsSystemWindows="true"
android:layout_height="fill_parent"
android:background="@color/white"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:paddingLeft="@dimen/_10sdp"
android:paddingRight="@dimen/_10sdp"
android:layout_gravity="center_vertical"
android:id="@+id/activity_login_parent_layout"
android:orientation="vertical">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/circleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:focusableInTouchMode="false"
android:focusable="false"
android:layout_marginTop="@dimen/_30sdp"
android:src="@drawable/logo" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.AppCompatEditText
android:id="@+id/activity_user_login_username_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:minLines="1"
android:singleLine="true"
android:inputType="text"
android:focusableInTouchMode="true"
android:layout_marginTop="@dimen/_30sdp"
android:hint="Username" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.AppCompatEditText
android:id="@+id/activity_user_login_password_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_10sdp"
android:maxLines="1"
android:minLines="1"
android:hint="Password"
android:singleLine="true"
android:focusableInTouchMode="true"
android:imeOptions="actionDone"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_5sdp"
android:gravity="right"
android:visibility="gone"
android:id="@+id/activity_user_login_forgot_pwd_tv"
android:paddingRight="@dimen/_10sdp"
android:text="Forgot Password?" />
<Button
android:id="@+id/activity_user_login_btn"
style="@style/button"
android:layout_marginLeft="@dimen/_20sdp"
android:layout_marginRight="@dimen/_20sdp"
android:layout_marginTop="@dimen/_20sdp"
android:layout_marginBottom="@dimen/_10sdp"
android:layout_width="fill_parent"
android:textAllCaps="false"
android:layout_height="wrap_content"
android:text="Login" />
<Button
android:layout_width="wrap_content"
android:text="Change URL"
android:id="@+id/activity_user_login_change_url_btn"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:paddingLeft="@dimen/_50sdp"
android:layout_marginRight="@dimen/_20sdp"
android:drawablePadding="@dimen/_5sdp"
android:drawableLeft="@drawable/change_url"
android:layout_gravity="right"
android:textColor="@color/grey"
android:textAllCaps="false"
android:gravity="right|center_vertical"
android:layout_height="wrap_content" />
</LinearLayout>
</ScrollView>
Mein Code wie folgt aus: code for login
Jede Hilfe sehr geschätzt wird.
Verwendung normaler EditText mit TextInputLayout. –
Ich kann nicht herausfinden, warum Sie immer noch 'EditText's Fehlermethoden verwenden, während' TextInputLayout' eine eigene und coole Methode hat! – Wizard
@SnehaSarkar nicht funktioniert, ich wurde versucht –