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

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

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

問題描述

限時送ChatGPT賬號..

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

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?

謝謝

推薦答案

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

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.

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

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

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

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

相關文檔推薦

Cut, copy, paste in android(在android中剪切、復制、粘貼)
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 位小數的數字)
Changing where cursor starts in an expanded EditText(更改光標在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 欧美精品网站 | 国产精品久久精品 | 亚洲一区二区在线播放 | 一区二区三区四区电影视频在线观看 | 成人av观看 | 91视频在线 | 日韩中文字幕在线免费 | 一级做a爰片性色毛片16 | 华丽的挑战在线观看 | 成人欧美一区二区 | 免费看啪啪网站 | 成人国产精品 | 日韩免费一区二区 | 久久国产精品久久久久久久久久 | av日韩高清 | 久久亚洲综合 | 日日干日日操 | 精品中文字幕在线 | 一本大道久久a久久精二百 欧洲一区二区三区 | 中文字幕a√| 中文字幕在线视频一区二区三区 | 久久久久久国产精品久久 | 一区二区三区免费 | 污免费网站 | 欧美一级免费看 | 久久不卡 | 欧美精品一区在线 | 成人欧美一区二区三区色青冈 | 久久精品无码一区二区三区 | 亚洲国产中文字幕 | 春色av| 亚洲免费观看 | 日韩三级在线 | 成人二区 | 国产午夜精品一区二区三区嫩草 | 日本午夜一区二区三区 | 欧美国产一区二区 | 久久婷婷国产 | 91精品国产综合久久福利软件 | 日韩视频区 | www.天天操 |