Enas AL Saeek Enas AL Saeek - 2 months ago 27
Android Question

TextInputLayout error icon appear in both side

i'm working on android application for registration operations
i'm using


compile SdkVersion 24

buildToolsVersion "24.0.1"

compile 'com.android.support:appcompat-v7:24.2.1'

compile
'com.android.support:design:24.2.1'


and the xml code for this layout is:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fitsSystemWindows="true">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingTop="56dp">

<ImageView
android:layout_width="wrap_content"
android:layout_height="72dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="24dp"
android:src="@drawable/logo" />

<!-- Full Name Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">

<EditText
android:id="@+id/input_full_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Full_Name"

android:inputType="textCapWords" />
</android.support.design.widget.TextInputLayout>

<!-- User Name Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">

<EditText
android:id="@+id/input_user_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/User_Name"

android:inputType="textCapWords" />
</android.support.design.widget.TextInputLayout>

<!--Gender-->
<RadioGroup
android:id="@+id/RG"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">

<RadioButton
android:id="@+id/male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/man"
android:text="@string/Male" />

<RadioButton
android:id="@+id/female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:drawableLeft="@drawable/woman"
android:text="@string/FeMale" />
</RadioGroup>

<!--Birthday-->
<TextView
android:id="@+id/input_birthday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="@string/BirthDay"></TextView>


<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">

<android.support.design.widget.TextInputLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"

android:layout_weight="1">

<EditText
android:id="@+id/spinner_day"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Day"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1">

<EditText
android:id="@+id/spinner_month"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Month"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_weight="1">

<EditText
android:id="@+id/spinner_year"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Year"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>


</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/txt_lable_p"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/Add_Contact_Info"
android:textColor="@color/ColorPrimaryDark"
android:textSize="@dimen/textSize_medium3" />
<ImageView
android:id="@+id/infoContact"
android:layout_marginTop="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_info_details"/>
</LinearLayout>

<!-- WhatsApp Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">

<EditText
android:id="@+id/input_whatsApp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/WhatsApp"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>

<!-- PhoneNumber Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">

<EditText
android:id="@+id/input_phoneNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/PhoneNumber"
android:inputType="number" />
</android.support.design.widget.TextInputLayout>

<!-- Facebook Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">

<EditText
android:id="@+id/input_facebook"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Facebook"
android:inputType="textWebEditText" />
</android.support.design.widget.TextInputLayout>

<!-- Twitter Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">

<EditText
android:id="@+id/input_twitter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Twitter"
android:inputType="textWebEditText" />
</android.support.design.widget.TextInputLayout>

<!-- Password Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">

<EditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>

<!-- Confirm Password Label -->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">

<EditText
android:id="@+id/input_confirm_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Confirm_Password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>

<!-- Question Password Label -->
<TextView
android:id="@+id/QPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="@string/QPassword" />

<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp">

<android.support.v7.widget.AppCompatEditText
android:id="@+id/input_Q_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Q1"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>

<!--job-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioGroup
android:id="@+id/RGJob"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/lookjob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/LookJob" />

<ImageView
android:id="@+id/infoLookJob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_info_details"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/havejob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/HaveJob" />
<ImageView
android:id="@+id/infoHaveJob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_info_details"/>
</LinearLayout>
<RadioButton
android:id="@+id/None"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/NoThing" />
</RadioGroup>
</LinearLayout>

<TextView
android:id="@+id/attchjob"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="@string/AttachAds"
android:visibility="gone" />

<android.support.design.widget.TextInputLayout
android:id="@+id/ads_layout"
android:layout_width="match_parent"
android:layout_height="170dp"
android:layout_margin="10dp"
android:background="@drawable/et"
android:visibility="gone">

<EditText
android:id="@+id/input_ads"
android:layout_width="match_parent"
android:layout_height="160dp"
android:layout_margin="10dp"
android:gravity="top"
android:inputType="textCapSentences|textMultiLine" />
</android.support.design.widget.TextInputLayout>


<Button
android:id="@+id/attach_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:text="@string/Image"
android:textAllCaps="false"
android:textColor="#ffffff"
android:theme="@style/MyButton"
android:visibility="gone" />

<TextView
android:id="@+id/url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:visibility="gone" />

<ImageView
android:id="@+id/urlimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:adjustViewBounds="true"
android:visibility="gone" />

<!-- Signup Button -->
<android.support.v7.widget.AppCompatButton
android:id="@+id/btn_signup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:padding="12dp"
android:text="@string/signUp" />

<TextView
android:id="@+id/link_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:gravity="center"
android:text="@string/AlreadyLogin"
android:textColor="@color/primary_dark"
android:textSize="16dip" />
</LinearLayout>
</ScrollView>


when i run it , it appeared like this
register layout

java code for this field:

if (answerPassword.isEmpty() || Password.length() < 2 ) {
Answer.setError(getResources().getString(R.string.ErrorAnswer));

}


the error icon appear in both side of textinputlayout , why ?

Answer

Try to rebuild the project with com.android.support:design:24.1.0. There is some issue with 24.2.1 library. using another version in my project i couldn't even get error message. So 24.2.1 is the issue. change it to 24.1.0 and rebuild.