I had some problem with my show password icon in TextInputLayout with android:inputType="textPassword"
. Right now it is showing like this
As you can see the show password icon is touching the base line. I want something like this
You can see the gap between them.
The xml sode for implementing TextInputLayout is given below:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/TextLabelSNA"
app:layout_constraintTop_toBottomOf="@+id/mailSave"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
android:id="@+id/tilOp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintVertical_bias="0.0">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textPassword"
android:hint="Old Password"
android:ems="10"
android:textColor="#0A0B12"
android:id="@+id/oldPassword"/>
</android.support.design.widget.TextInputLayout>
style used is:
<style name="TextLabelSNA" parent="Widget.Design.TextInputLayout">
<!-- Hint color and label color in FALSE state -->
<item name="android:textColorHint">@color/hintBlack</item>
<item name="android:textSize">16sp</item>
<!-- Label color in TRUE state and bar color FALSE and TRUE State -->
<item name="colorAccent">@color/hintBlack</item>
<item name="colorControlNormal">@color/hintBlack</item>
<item name="colorControlActivated">@color/hintBlack</item>
</style>
Please Help..!!!
change the edittext input type property to text password in xml. Show activity on this post. As the original poster mentioned in a comment, calling setSingleLine (boolean singleLine) resets the EditText settings, so you'll have to call that first and after that set custom settings like the password InputType .
You can remove extra space above AppCompatEditText by setting app:hintEnabled="false" to TextInputLayout but it won't display hint until you re-enable that.
just add app:passwordToggleEnabled="true" in your textinputlayout
<android.support.design.widget.TextInputLayout
app:layout_widthPercent="90%"
android:layout_height="wrap_content"
android:hint="@string/password"
android:textColorHint="@android:color/white"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@android:color/white">
<android.support.v7.widget.AppCompatEditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:textColor="@android:color/white"
android:visibility="gone"
/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/inputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true">
<EditText
android:id="@+id/txtpwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:drawableLeft="@drawable/lock"
android:ems="10"
android:hint=" Password"
android:imeOptions="actionGo"
android:inputType="textPassword"
android:padding="10dp">
</EditText>
</android.support.design.widget.TextInputLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With