How can I obtain an EditText
as those bellow?
The x button removes the text inserted and the eye button displays the clear password as long as it's pressed. Note that I refer to them as buttons because I don't really know what they actually are nor if they are part of the EditText itself or if they are independent views.
You can just add a button at the right of your EditText
<FrameLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/ScreenLoginContainer">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/edit_text_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:imeOptions="actionDone"
android:hint="@string/enter_password_hint"
android:paddingRight="30dp"
style="@style/ScreenPasswordEditText"/>
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+screen_card_ean_enter/show_password_button"
style="@style/ShowHidePasswordButton"/>
</FrameLayout>
You can use android:drawableRight
Set a Drawable to the right of the text, in EditText, in XML .
android:drawableRight="@drawable/Your_drawable"
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