Android中實現(xiàn)EditText密碼顯示隱藏的方法
在Google發(fā)布了support:design:23+以后我們發(fā)現(xiàn)有這么一個東西TextInputLayout,先看下效果圖:

<android.support.design.widget.TextInputLayout android:id="@+id/pwdLayout" android:layout_width="match_parent" android:layout_height="wrap_content" app:passwordToggleEnabled="true" > <EditText android:id="@+id/pwdEdt" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="@string/edt_pwd_hint" android:maxLines="1" android:inputType="textPassword" /> </android.support.design.widget.TextInputLayout>
只要在布局中添加屬性app:passwordToggleEnabled=”true”就可以實現(xiàn)當(dāng)EditText的inputType=”textPassword”的時候在輸入框的最右邊就會顯示眼睛一樣的開關(guān)來顯示和隱藏密碼,需要的同學(xué)不妨試試看。
參考:
http://stackoverflow.com/questions/39019675/remove-show-password-icon-in-android-n
相關(guān)閱讀:
以上所述是小編給大家介紹的Android中實現(xiàn)EditText密碼顯示隱藏的方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
- Android實現(xiàn)密碼隱藏和顯示
- Android實現(xiàn)顯示和隱藏密碼功能的示例代碼
- Android 登錄頁面的實現(xiàn)代碼(密碼顯示隱藏、EditText 圖標(biāo)切換、限制輸入長度)
- Android中實現(xiàn)密碼的隱藏和顯示的示例
- Android EditText密碼的隱藏和顯示功能
- Android 密碼 顯示與隱藏功能實例
- Android文本輸入框(EditText)輸入密碼時顯示與隱藏
- Android實現(xiàn)動態(tài)顯示或隱藏密碼輸入框的內(nèi)容
- Android中EditText顯示明文與密碼的兩種方式
- Android開發(fā)EditText實現(xiàn)密碼顯示隱藏
相關(guān)文章
調(diào)用startService會拋出IllegalStateException異常解決
這篇文章主要為大家介紹了調(diào)用startService會拋出IllegalStateException異常解決,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-07-07
Android自定義ProgressBar實現(xiàn)漂亮的進(jìn)度提示框
這篇文章主要為大家詳細(xì)介紹了Android自定義ProgressBar實現(xiàn)漂亮的進(jìn)度提示框,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-06-06
Android Retrofit 2.0框架上傳圖片解決方案
這篇文章主要介紹了Android Retrofit 2.0框架上傳一張與多張圖片解決方案,感興趣的小伙伴們可以參考一下2016-03-03
詳解Android 進(jìn)程間通信的幾種實現(xiàn)方式
在Android SDK中提供了4種用于跨進(jìn)程通訊的方式。這篇文章主要介紹了詳解Android 進(jìn)程間通信的幾種實現(xiàn)方式,有興趣的可以了解一下。2017-01-01
詳解xamarin Android 實現(xiàn)ListView萬能適配器
這篇文章主要介紹了詳解xamarin Android 實現(xiàn)ListView萬能適配器的相關(guān)資料,這里主要實現(xiàn)listview 適配器的實例,需要的朋友可以參考下2017-08-08

