久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

將 EditText 密碼掩碼字符更改為星號 (*)

Change EditText password mask character to asterisk (*)(將 EditText 密碼掩碼字符更改為星號 (*))
本文介紹了將 EditText 密碼掩碼字符更改為星號 (*)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

有什么方法可以將密碼文本從點(.)更改為星號(*).

Is there any way to change the password text from dot(.) to asterisk(*) .

密碼正在編輯文本中輸入.

Password is entering in edittext.

<EditText
        android:id="@+id/passWord1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:inputType="number"
        android:password="true"/>

推薦答案

在你的xml文件中插入edittext,

Insert edittext in your xml file,

<EditText
    android:id="@+id/passWordEditText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:inputType="textPassword"/>

你的類文件繼續從edittext獲取findViewById并為此實現,

and your class file go on and get findViewById from edittext and implement for this,

EditText edittext = (EditText)findViewById(R.id.passWordEditText);
edittext.setTransformationMethod(new AsteriskPasswordTransformationMethod());

這個類實現了,

public class AsteriskPasswordTransformationMethod extends PasswordTransformationMethod {
    @Override
    public CharSequence getTransformation(CharSequence source, View view) {
        return new PasswordCharSequence(source);
    }
 
    private class PasswordCharSequence implements CharSequence {
        private CharSequence mSource;
        public PasswordCharSequence(CharSequence source) {
            mSource = source; // Store char sequence
        }
        public char charAt(int index) {
            return '*'; // This is the important part
        }
        public int length() {
            return mSource.length(); // Return default
        }
        public CharSequence subSequence(int start, int end) {
            return mSource.subSequence(start, end); // Return default
        }
    }
};

如果您的代碼是 Kotlin,那么您必須制作單獨的 java 文件,然后您必須將 java 與 kotlin 代碼一起使用.

這篇關于將 EditText 密碼掩碼字符更改為星號 (*)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設置為僅接受 Android 中的數值?)
主站蜘蛛池模板: 久久一区二区免费视频 | 国产高清精品在线 | 天天操天天插 | 国产亚洲一区二区在线观看 | 啪啪免费网| 成人亚洲视频 | 亚洲综合国产精品 | 麻豆国产精品777777在线 | 日韩福利在线观看 | 久久9热 | 久久高清 | 99久热在线精品视频观看 | 精品福利在线视频 | 精品久久久久久久久久久 | 天天爽夜夜骑 | 成年人网站免费 | 黄色日本视频 | 亚洲精品一区二区在线观看 | 中文字幕一区二区三 | 国产精品久久久久久久久久妇女 | 国产欧美日韩一区二区三区 | 国产一级黄色网 | 一级毛片成人免费看a | 亚洲免费三区 | 美女一区二区在线观看 | 国产午夜视频 | 亚洲一区二区在线播放 | 一区二区三区视频在线免费观看 | 久久久久久久久一区 | 91视频.com| 欧美久久久久 | 国产一级黄色网 | 精品美女视频在免费观看 | 欧美日韩综合视频 | 中文字幕免费视频 | 羞羞色在线观看 | 自拍第1页| 午夜影院在线观看版 | 国产欧美一区二区三区久久手机版 | av免费网站在线 | 久草精品视频 |