This is using material design:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/login_pwd"
app:endIconMode="password_toggle"
app:errorEnabled="true"
app:startIconDrawable="@drawable/ic_lock">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/etLoginClave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
You can use something like:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
app:boxBackgroundColor="@color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:placeholderText="Password"
app:expandedHintEnabled="false"
app:endIconMode="password_toggle"
>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textPassword"
/>
</com.google.android.material.textfield.TextInputLayout>
Use app:expandedHintEnabled="false"
to display the placeholder also when the text field is empty.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.