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

在android中如何顯示星號(*)代替EditText中的點(diǎn),輸

In android how to show asterisk (*) in place of dots in EditText having inputtype as textPassword?(在android中如何顯示星號(*)代替EditText中的點(diǎn),輸入類型為textPassword?)
本文介紹了在android中如何顯示星號(*)代替EditText中的點(diǎn),輸入類型為textPassword?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時送ChatGPT賬號..

我試圖用 asterisk (*) 符號代替 EditText 中的點(diǎn),其中 inputTypetextPassword.我遇到了要求使用 setTransformationMethod() 并實(shí)現(xiàn) PasswordTransformationMethod 的帖子.但是我需要實(shí)現(xiàn)該類的哪個方法以及如何顯示星號?還有其他方法嗎?

I am trying to show in asterisk (*) symbol in place of dots in EditText having inputType as textPassword. I came across post that ask to use setTransformationMethod() and implement PasswordTransformationMethod. But which method I of that class need I implement and how show asterisk? Is there other way to do that?

謝謝

推薦答案

我覺得你應(yīng)該通過文檔.創(chuàng)建你的 PasswordTransformationMethod 類,并在 getTransformation() 方法中,只返回與內(nèi)容長度相同的 * 字符串您的密碼字段.

I think you should go through the documentation. Create your PasswordTransformationMethod class, and in the getTransformation() method, just return a string of * characters that is the same length as the contents of your password field.

我做了一些擺弄,想出了一個匿名類,它可以讓我創(chuàng)建一個充滿 * 的字段.我在這里將其轉(zhuǎn)換為可用的類:

I did some fiddling and came up with an anonymous class that worked for me to make a field full of *s. I converted it into a usable class here:

public class MyPasswordTransformationMethod 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
        }
    }
};

// Call the above class using this:
text.setTransformationMethod(new MyPasswordTransformationMethod());

這篇關(guān)于在android中如何顯示星號(*)代替EditText中的點(diǎn),輸入類型為textPassword?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Cut, copy, paste in android(在android中剪切、復(fù)制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數(shù)的數(shù)字)
Changing where cursor starts in an expanded EditText(更改光標(biāo)在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 午夜电影网 | 国产一区二区三区四区在线观看 | 精品少妇一区二区三区日产乱码 | 久久久久国产一区二区三区四区 | 国产精品一区二区无线 | 亚洲经典一区 | 久久久久久久av | 日韩在线不卡视频 | 国产在线a | 91观看 | 中文字幕国产视频 | 91私密视频 | 91国内产香蕉 | 女人天堂av | 欧美久久久久久久久中文字幕 | 国产一在线观看 | 午夜影晥 | 日韩欧美在线不卡 | 日韩欧美高清 | 日韩成人一区 | 日本不卡免费新一二三区 | 日本a v在线播放 | 国产一区免费 | 一级欧美视频 | 一区二区三区四区av | 亚洲欧美中文日韩在线v日本 | 激情一区 | 亚洲人va欧美va人人爽 | 午夜视频网站 | 国产精产国品一二三产区视频 | 日韩精品一区二区在线观看 | 日日操日日干 | 午夜欧美a级理论片915影院 | 热久久性 | 免费国产黄网站在线观看视频 | 一区二区三区国产 | 色综合天天综合网国产成人网 | 91婷婷韩国欧美一区二区 | 91精品国产综合久久久久久丝袜 | 日本不卡一区 | 国产香蕉视频 |