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

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

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

問題描述

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

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"/>

你的類文件繼續(xù)從edittext獲取findViewById并為此實現(xiàn),

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());

這個類實現(xiàn)了,

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 代碼一起使用.

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

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

相關(guān)文檔推薦

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 操作標(biāo)簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉(zhuǎn)對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設(shè)置為僅接受 Android 中的數(shù)值?)
主站蜘蛛池模板: 日韩成人 | 激情视频一区 | 三级免费毛片 | 中文字幕亚洲一区二区va在线 | 国产第一区二区 | 精品国产青草久久久久96 | 精品成人免费一区二区在线播放 | 97精品国产| 18性欧美 | 国产激情精品 | 91精品国产91久久综合桃花 | 亚洲免费在线观看 | 亚洲精品电影网在线观看 | 国产一级特黄视频 | 中文字幕第一页在线 | 免费成人在线网站 | 国产在线小视频 | 免费毛片网站在线观看 | 91精品国产手机 | 国产精品乱码一区二区三区 | 免费黄色特级片 | 日本欧美视频 | av网址在线播放 | 久久精品国产一区二区三区不卡 | 黄色电影在线免费观看 | 99久久久久| 午夜精品网站 | 欧美在线视频不卡 | 国产精品久久久久久久久久尿 | 久国产视频 | 一道本不卡 | 欧美影院 | 日韩一区二区黄色片 | 日韩和的一区二区 | 国产成人高清 | 亚洲精品高清视频 | 黄色一级大片在线免费看产 | 久久精品成人一区 | 久久99精品视频 | 国产一区二区精品自拍 | 日韩精品专区在线影院重磅 |