{"id":5469,"date":"2021-11-05T13:31:51","date_gmt":"2021-11-05T05:31:51","guid":{"rendered":"http:\/\/xinyiworld.top\/wordpress\/?p=5469"},"modified":"2022-08-29T19:35:50","modified_gmt":"2022-08-29T11:35:50","slug":"edittext","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469","title":{"rendered":"EditText"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_16 counter-hierarchy counter-decimal ez-toc-grey\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" style=\"display: none;\"><i class=\"ez-toc-glyphicon ez-toc-icon-toggle\"><\/i><\/a><\/span><\/div>\n<nav><ul class=\"ez-toc-list ez-toc-list-level-1\"><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#1%E5%8E%BB%E6%8E%89%E4%B8%8B%E9%9D%A2%E7%9A%84%E6%A8%AA%E7%BA%BF\" title=\"1.\u53bb\u6389\u4e0b\u9762\u7684\u6a2a\u7ebf\">1.\u53bb\u6389\u4e0b\u9762\u7684\u6a2a\u7ebf<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#2%E7%82%B9%E5%87%BBActivity%E4%BB%BB%E6%84%8F%E5%9C%B0%E6%96%B9%E5%85%B3%E9%97%AD%E8%BD%AF%E9%94%AE%E7%9B%98\" title=\"2.\u70b9\u51fbActivity\u4efb\u610f\u5730\u65b9\u5173\u95ed\u8f6f\u952e\u76d8\">2.\u70b9\u51fbActivity\u4efb\u610f\u5730\u65b9\u5173\u95ed\u8f6f\u952e\u76d8<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#3%E8%AE%BE%E7%BD%AE%E5%85%89%E6%A0%87%E4%BD%8D%E7%BD%AE\" title=\"3.\u8bbe\u7f6e\u5149\u6807\u4f4d\u7f6e\">3.\u8bbe\u7f6e\u5149\u6807\u4f4d\u7f6e<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#4addTextChangedListener%E7%9B%91%E5%90%AC%E7%9A%84%E6%AD%BB%E5%BE%AA%E7%8E%AF%E9%97%AE%E9%A2%98\" title=\"4.addTextChangedListener\u76d1\u542c\u7684\u6b7b\u5faa\u73af\u95ee\u9898\">4.addTextChangedListener\u76d1\u542c\u7684\u6b7b\u5faa\u73af\u95ee\u9898<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-5\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#5%E4%BF%AE%E6%94%B9%E9%94%AE%E7%9B%98%E9%87%8C%E7%9A%84%E5%9B%9E%E8%BD%A6\" title=\"5.\u4fee\u6539\u952e\u76d8\u91cc\u7684\u56de\u8f66\">5.\u4fee\u6539\u952e\u76d8\u91cc\u7684\u56de\u8f66<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-6\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#6%E4%B8%8D%E8%A7%A6%E6%91%B8EditText%E5%B0%B1%E5%BC%B9%E5%87%BA%E8%BD%AF%E9%94%AE%E7%9B%98\" title=\"6.\u4e0d\u89e6\u6478EditText\u5c31\u5f39\u51fa\u8f6f\u952e\u76d8\">6.\u4e0d\u89e6\u6478EditText\u5c31\u5f39\u51fa\u8f6f\u952e\u76d8<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-7\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#7%E9%BB%98%E8%AE%A4%E8%AE%A9%E6%9F%90%E4%B8%AAEditText%E8%8E%B7%E5%8F%96%E7%84%A6%E7%82%B9\" title=\"7.\u9ed8\u8ba4\u8ba9\u67d0\u4e2aEditText\u83b7\u53d6\u7126\u70b9\">7.\u9ed8\u8ba4\u8ba9\u67d0\u4e2aEditText\u83b7\u53d6\u7126\u70b9<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-8\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#8%E5%B8%A6%E5%88%A0%E9%99%A4%E7%9A%84EditText\" title=\"8.\u5e26\u5220\u9664\u7684EditText\">8.\u5e26\u5220\u9664\u7684EditText<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-9\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#9%E9%99%90%E5%88%B6EditText%E8%BE%93%E5%85%A5%E5%B0%8F%E6%95%B0%E7%82%B9%E5%90%8E%E9%9D%A2%E4%BD%8D%E6%95%B0\" title=\"9.\u9650\u5236EditText\u8f93\u5165\u5c0f\u6570\u70b9\u540e\u9762\u4f4d\u6570\">9.\u9650\u5236EditText\u8f93\u5165\u5c0f\u6570\u70b9\u540e\u9762\u4f4d\u6570<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-10\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#10%E6%94%B9%E5%8F%98%E5%85%89%E6%A0%87\" title=\"10.\u6539\u53d8\u5149\u6807\">10.\u6539\u53d8\u5149\u6807<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-11\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#11%E5%B0%86%E5%AF%86%E7%A0%81%E6%98%BE%E7%A4%BA%E7%9A%84%E7%82%B9%E5%8F%B7%E6%94%B9%E6%88%90%E5%8F%B7\" title=\"11.\u5c06\u5bc6\u7801\u663e\u793a\u7684\u70b9\u53f7\u6539\u6210*\u53f7\">11.\u5c06\u5bc6\u7801\u663e\u793a\u7684\u70b9\u53f7\u6539\u6210*\u53f7<\/a><\/li><li class=\"ez-toc-page-1 ez-toc-heading-level-4\"><a class=\"ez-toc-link ez-toc-heading-12\" href=\"http:\/\/xinyiworld.top\/wordpress_it\/?p=5469\/#12%E6%98%8E%E6%96%87%E4%B8%8E%E5%AF%86%E6%96%87%E6%98%BE%E7%A4%BA\" title=\"12.\u660e\u6587\u4e0e\u5bc6\u6587\u663e\u793a\">12.\u660e\u6587\u4e0e\u5bc6\u6587\u663e\u793a<\/a><\/li><\/ul><\/nav><\/div>\n<h4><span class=\"ez-toc-section\" id=\"1%E5%8E%BB%E6%8E%89%E4%B8%8B%E9%9D%A2%E7%9A%84%E6%A8%AA%E7%BA%BF\"><\/span>1.\u53bb\u6389\u4e0b\u9762\u7684\u6a2a\u7ebf<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u52a0\u4e2a\u80cc\u666f\u5373\u53ef<\/p>\n<p>\u8bbe\u7f6e\u9009\u4e2d\u65f6\u80cc\u666f<br \/>\n<a href=\"http:\/\/www.jianshu.com\/p\/7257ce82c762\">http:\/\/www.jianshu.com\/p\/7257ce82c762<\/a><\/p>\n<pre><code class=\"language-xml\">android:background=&quot;@null&quot;\nandroid:drawableBottom=&quot;@drawable\/selector_edittext_line&quot;<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"2%E7%82%B9%E5%87%BBActivity%E4%BB%BB%E6%84%8F%E5%9C%B0%E6%96%B9%E5%85%B3%E9%97%AD%E8%BD%AF%E9%94%AE%E7%9B%98\"><\/span>2.\u70b9\u51fbActivity\u4efb\u610f\u5730\u65b9\u5173\u95ed\u8f6f\u952e\u76d8<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"http:\/\/www.it165.net\/pro\/html\/201405\/13742.html\">http:\/\/www.it165.net\/pro\/html\/201405\/13742.html<\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"3%E8%AE%BE%E7%BD%AE%E5%85%89%E6%A0%87%E4%BD%8D%E7%BD%AE\"><\/span>3.\u8bbe\u7f6e\u5149\u6807\u4f4d\u7f6e<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><code>setSelection(addressBean.uname.length());<\/code><\/p>\n<h4><span class=\"ez-toc-section\" id=\"4addTextChangedListener%E7%9B%91%E5%90%AC%E7%9A%84%E6%AD%BB%E5%BE%AA%E7%8E%AF%E9%97%AE%E9%A2%98\"><\/span>4.addTextChangedListener\u76d1\u542c\u7684\u6b7b\u5faa\u73af\u95ee\u9898<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"https:\/\/blog.csdn.net\/qq_21229739\/article\/details\/50896029\">https:\/\/blog.csdn.net\/qq_21229739\/article\/details\/50896029<\/a><br \/>\n\u5728afterTextChanged\u65b9\u6cd5\u91cc\u5b9a\u4e49boolean\u6807\u8bb0\u53d8\u91cf<\/p>\n<h4><span class=\"ez-toc-section\" id=\"5%E4%BF%AE%E6%94%B9%E9%94%AE%E7%9B%98%E9%87%8C%E7%9A%84%E5%9B%9E%E8%BD%A6\"><\/span>5.\u4fee\u6539\u952e\u76d8\u91cc\u7684\u56de\u8f66<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"http:\/\/blog.csdn.net\/wang_shaner\/article\/details\/8467688\">http:\/\/blog.csdn.net\/wang_shaner\/article\/details\/8467688<\/a><\/p>\n<p>EditText\u4e2dimeOptions\u5c5e\u6027\u4f7f\u7528\u53ca\u8bbe\u7f6e\u65e0\u6548\u89e3\u51b3<br \/>\n<a href=\"http:\/\/blog.csdn.net\/lastdream\/article\/details\/24365633\">http:\/\/blog.csdn.net\/lastdream\/article\/details\/24365633<\/a><br \/>\n\u7ecf\u8fc7\u8bd5\u9a8c \u8bbe\u7f6e\u4e0b\u9762\u4e24\u4e2a\u5c5e\u6027\u4e2d\u7684\u4e00\u4e2a\u5373\u53ef\u4f7f\u8fd9\u4e2a\u5c5e\u6027\u751f\u6548\uff08\u5e94\u8be5\u8fd8\u6709\u5176\u4ed6\u7684\u5c5e\u6027\u4e5f\u53ef\u4ee5,\u6ca1\u53bb\u8bd5\u9a8c\uff09<br \/>\n1 \u5c06singleLine\u8bbe\u7f6e\u4e3atrue<br \/>\n2 \u5c06inputType\u8bbe\u7f6e\u4e3atext<\/p>\n<h4><span class=\"ez-toc-section\" id=\"6%E4%B8%8D%E8%A7%A6%E6%91%B8EditText%E5%B0%B1%E5%BC%B9%E5%87%BA%E8%BD%AF%E9%94%AE%E7%9B%98\"><\/span>6.\u4e0d\u89e6\u6478EditText\u5c31\u5f39\u51fa\u8f6f\u952e\u76d8<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"http:\/\/www.360doc.com\/content\/14\/0722\/10\/11800748_396211794.shtml\">http:\/\/www.360doc.com\/content\/14\/0722\/10\/11800748_396211794.shtml<\/a><\/p>\n<pre><code class=\"language-java\">etMainContent.requestFocus();\nInputMethodManager  imm = (InputMethodManager) etMainContent.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);\nimm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"7%E9%BB%98%E8%AE%A4%E8%AE%A9%E6%9F%90%E4%B8%AAEditText%E8%8E%B7%E5%8F%96%E7%84%A6%E7%82%B9\"><\/span>7.\u9ed8\u8ba4\u8ba9\u67d0\u4e2aEditText\u83b7\u53d6\u7126\u70b9<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-java\">searchView.setFocusable(true);\nsearchView.setFocusableInTouchMode(true);\nsearchView.requestFocus();\n\nsearchView.clearFocus();\/\/\u5931\u53bb\u7126\u70b9\nsearchView.requestFocus();\/\/\u83b7\u53d6\u7126\u70b9<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"8%E5%B8%A6%E5%88%A0%E9%99%A4%E7%9A%84EditText\"><\/span>8.\u5e26\u5220\u9664\u7684EditText<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"http:\/\/blog.csdn.net\/xuyonghong1122\/article\/details\/46663601#\">http:\/\/blog.csdn.net\/xuyonghong1122\/article\/details\/46663601#<\/a><\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/xiaanming\/article\/details\/11066685\/\">http:\/\/blog.csdn.net\/xiaanming\/article\/details\/11066685\/<\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"9%E9%99%90%E5%88%B6EditText%E8%BE%93%E5%85%A5%E5%B0%8F%E6%95%B0%E7%82%B9%E5%90%8E%E9%9D%A2%E4%BD%8D%E6%95%B0\"><\/span>9.\u9650\u5236EditText\u8f93\u5165\u5c0f\u6570\u70b9\u540e\u9762\u4f4d\u6570<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"https:\/\/blog.csdn.net\/b7223058\/article\/details\/77839556\">https:\/\/blog.csdn.net\/b7223058\/article\/details\/77839556<\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"10%E6%94%B9%E5%8F%98%E5%85%89%E6%A0%87\"><\/span>10.\u6539\u53d8\u5149\u6807<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>1.\u5728\u8d44\u6e90\u6587\u4ef6drawable\u4e0b\u65b0\u5efa\u4e00\u4e2a\u5149\u6807\u63a7\u5236color_cursor.xml<\/p>\n<pre><code class=\"language-xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\n&lt;shape xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot; android:shape=&quot;rectangle&quot;&gt;\n    &lt;size android:width=&quot;1dp&quot; \/&gt;\n    &lt;solid android:color=&quot;#008000&quot;  \/&gt;\n&lt;\/shape&gt;<\/code><\/pre>\n<p>2.\u8bbe\u7f6eEditText\uff1aandroid:textCursorDrawable=&quot;@drawable\/color_cursor&quot;<\/p>\n<h4><span class=\"ez-toc-section\" id=\"11%E5%B0%86%E5%AF%86%E7%A0%81%E6%98%BE%E7%A4%BA%E7%9A%84%E7%82%B9%E5%8F%B7%E6%94%B9%E6%88%90%E5%8F%B7\"><\/span>11.\u5c06\u5bc6\u7801\u663e\u793a\u7684\u70b9\u53f7\u6539\u6210*\u53f7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"https:\/\/blog.csdn.net\/weixin_33541245\/article\/details\/117840731\">https:\/\/blog.csdn.net\/weixin_33541245\/article\/details\/117840731<\/a><\/p>\n<pre><code class=\"language-java\">EditText UPL =(EditText) findViewById(R.id.UserPasswordToLogin) ;\nUPL.setTransformationMethod(new AsteriskPasswordTransformationMethod());<\/code><\/pre>\n<p>\u7136\u540e\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Java\u7c7b\uff0c\u540d\u4e3aAsteriskPasswordTransformationMethod.java\u5ef6\u4f38<\/p>\n<p>\u8fd9\u91cc\u662f\u4ee3\u7801\uff1a<\/p>\n<pre><code class=\"language-java\">public class AsteriskPasswordTransformationMethod extends PasswordTransformationMethod {\n    @Override\n\n    public CharSequence getTransformation(CharSequence source, View view) {\n        return new PasswordCharSequence(source);\n\n    }\n\n    private class PasswordCharSequence implements CharSequence {\n        private CharSequence mSource;\n\n        public PasswordCharSequence(CharSequence source) {\n            mSource = source; \/\/ Store char sequence\n        }\n\n        @Override\n        public char charAt(int index) {\n            return &#039;*&#039;; \/\/ This is the important part\n        }\n\n        @Override\n        public int length() {\n            return mSource.length(); \/\/ Return default\n\n        }\n\n        @Override\n        public CharSequence subSequence(int start, int end) {\n            return mSource.subSequence(start, end); \/\/ Return default\n        }\n    }\n\n}<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"12%E6%98%8E%E6%96%87%E4%B8%8E%E5%AF%86%E6%96%87%E6%98%BE%E7%A4%BA\"><\/span>12.\u660e\u6587\u4e0e\u5bc6\u6587\u663e\u793a<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-java\"> if (isChecked) {\n    \/\/\u660e\u6587\nmBinding.editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);\nmBinding.editText.setTransformationMethod(null);\n } else {\n     \/\/\u5bc6\u7801 TYPE_CLASS_TEXT \u548c TYPE_TEXT_VARIATION_PASSWORD \u5fc5\u987b\u4e00\u8d77\u4f7f\u7528\n     mBinding.editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);\n     \/\/\u5c06\u5bc6\u7801\u8f93\u5165\u6846\u7684\u70b9\u53f7\u53d8\u6210*\u53f7\n     mBinding.editText.setTransformationMethod(asteriskPasswordTransformationMethod);\n }<\/code><\/pre>\n<blockquote>\n<p>\u5f53\u8bbe\u7f6e\u660e\u6587\u4e0e\u5bc6\u6587\u65f6\uff0c\u5149\u6807\u4f1a\u81ea\u52a8\u8df3\u5230\u5934\uff0c\u5982\u4f55\u89e3\u51b3\u3002<\/p>\n<\/blockquote>\n<p>\u539f\u56e0\uff1a\u9996\u5148\u4e0a\u9762\u7684\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u5f15\u8d77EditText\u7684onSelectionChanged\u65b9\u6cd5\u56de\u8c03(0,0)<br \/>\n\u81ea\u5b9a\u4e49EditTextView\uff0c\u8bb0\u5f55\u5149\u6807\u4f4d\u7f6e\u3002<\/p>\n<pre><code class=\"language-java\">public class CursorWatchEditTextView extends androidx.appcompat.widget.AppCompatEditText {\n    \/**\n     * \u662f\u5426\u8bb0\u5f55\u5149\u6807\u4f4d\u7f6e.\n     * \u660e\u5bc6\u6587\u5207\u6362\u65f6\u4f1a\u89e6\u53d1{@link #onSelectionChanged(int, int)}\n     * \u65f6\uff0c\u6b64\u65f6\u4e0d\u5e94\u8be5\u8bb0\u5f55.\n     *\/\n    private boolean recordCursorIndex = true;\n\n    \/**\n     * \u5149\u6807\u4f4d\u7f6e .\n     *\/\n    private int cursorIndex = 0;\n\n    public CursorWatchEditTextView(Context context) {\n        super(context);\n    }\n\n    public CursorWatchEditTextView(Context context, AttributeSet attrs) {\n        super(context, attrs);\n    }\n\n    public CursorWatchEditTextView(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n    }\n\n    @Override\n    protected void onSelectionChanged(int selStart, int selEnd) {\n        super.onSelectionChanged(selStart, selEnd);\n        LogUtils.d(&quot;TAG&quot;, &quot;onSelectionChanged selStart = &quot; + selStart + &quot;,selEnd = &quot; + selEnd);\n        if (recordCursorIndex) {\n            this.cursorIndex = selStart;\n        } else {\n            LogUtils.d(&quot;TAG&quot;, &quot;onSelectionChanged but recordCursorIndex is false&quot;);\n        }\n    }\n\n    public void setRecordCursorIndex(boolean recordCursorIndex) {\n        this.recordCursorIndex = recordCursorIndex;\n    }\n\n    \/**\n     * \u6062\u590d\u5149\u6807\u4f4d\u7f6e.\n     *\/\n    public void restoreCurPosition() {\n        setSelection(cursorIndex);\n    }\n}<\/code><\/pre>\n<p>\u7136\u540e\u6267\u884c<\/p>\n<pre><code class=\"language-java\">\/\/\u4e0d\u8bb0\u5f55\u5149\u6807\u53d8\u5316\nmBinding.editText.setRecordCursorIndex(false);\n\u6267\u884c\u660e\u5bc6\u6587\u8bbe\u7f6e\u65b9\u6cd5\uff08\u5f15\u8d77\u5149\u6807\u53d8\u5316\uff09\n\/\/\u8bb0\u5f55\u5149\u6807\u53d8\u5316\nmBinding.editText.setRecordCursorIndex(true);\n\/\/\u6062\u590d\u5149\u6807\u4f4d\u7f6e\nmBinding.editText.restoreCurPosition();<\/code><\/pre>\n<pre><code class=\"language-java\">\/\/\u5bc6\u7801\u662f\u5426\u53ef\u89c1\u63a7\u5236 .\n            mBinding.cbInputVisible.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {\n                @Override\n                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\n                    mBinding.editText.setRecordCursorIndex(false);\n                    if (isChecked) {\n                        \/\/\u660e\u6587\n                        mBinding.editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);\n                        mBinding.editText.setTransformationMethod(null);\n                    } else {\n                        \/\/\u5bc6\u7801 TYPE_CLASS_TEXT \u548c TYPE_TEXT_VARIATION_PASSWORD \u5fc5\u987b\u4e00\u8d77\u4f7f\u7528\n                        mBinding.editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);\n                        \/\/\u5c06\u5bc6\u7801\u8f93\u5165\u6846\u7684\u70b9\u53f7\u53d8\u6210*\u53f7\n                        mBinding.editText.setTransformationMethod(asteriskPasswordTransformationMethod);\n                    }\n                    mBinding.editText.setRecordCursorIndex(true);\n                    mBinding.editText.restoreCurPosition();\n                }\n            });<\/code><\/pre>\n<button class=\"simplefavorite-button\" data-postid=\"5469\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55 1.\u53bb\u6389\u4e0b\u9762\u7684\u6a2a\u7ebf2.\u70b9\u51fbActivity\u4efb\u610f\u5730\u65b9\u5173\u95ed\u8f6f\u952e\u76d83.\u8bbe\u7f6e\u5149\u6807\u4f4d\u7f6e4.addText [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[343],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/5469"}],"collection":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5469"}],"version-history":[{"count":12,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/5469\/revisions"}],"predecessor-version":[{"id":6865,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/5469\/revisions\/6865"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5469"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}