{"id":189,"date":"2022-09-29T19:01:38","date_gmt":"2022-09-29T11:01:38","guid":{"rendered":"http:\/\/blog.nhl520.cn\/?p=189"},"modified":"2022-09-29T19:02:20","modified_gmt":"2022-09-29T11:02:20","slug":"android%e7%99%bb%e5%bd%95%e4%ba%8b%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/blog.nhl520.cn\/index.php\/2022\/09\/29\/android%e7%99%bb%e5%bd%95%e4%ba%8b%e4%bb%b6\/","title":{"rendered":"android\u767b\u5f55\u4e8b\u4ef6"},"content":{"rendered":"\n<p>\u6548\u679c\u56fe<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"364\" height=\"184\" src=\"https:\/\/blog.nhl520.cn\/wp-content\/uploads\/2022\/09\/\u5c4f\u5e55\u622a\u56fe-2022-09-29-185947.png\" alt=\"\" class=\"wp-image-190\" srcset=\"https:\/\/blog.nhl520.cn\/wp-content\/uploads\/2022\/09\/\u5c4f\u5e55\u622a\u56fe-2022-09-29-185947.png 364w, https:\/\/blog.nhl520.cn\/wp-content\/uploads\/2022\/09\/\u5c4f\u5e55\u622a\u56fe-2022-09-29-185947-300x152.png 300w\" sizes=\"auto, (max-width: 364px) 100vw, 364px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u662f\u7528\u672c\u5730\u7684\u8d26\u53f7\u5bc6\u7801\u6765\u5b9e\u73b0\u767b\u5f55\u7684\uff0c\u5982\u679c\u6709\u9700\u8981\u518d\u81ea\u5df1\u5bf9\u63a5\u670d\u52a1\u5668\u5373\u53ef<\/p>\n\n\n\n<p>1\u3001\u5148\u5728xml\u6587\u4ef6\u52a0\u5165\u4ee5\u4e0b\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"xml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;EditText\n      android:id=\"@+id\/edit1\"\n      android:hint=\"\u8bf7\u8f93\u5165\u8d26\u53f7\"\n      android:gravity=\"center\"\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"40dp\">\n\n  &lt;\/EditText>\n    &lt;EditText\n        android:id=\"@+id\/edit2\"\n        android:hint=\"\u8bf7\u8f93\u5165\u5bc6\u7801\"\n        android:gravity=\"center\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"40dp\">\n\n    &lt;\/EditText>\n    &lt;Button\n        android:id=\"@+id\/bottom\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"\u767b\u5f55\">\n    &lt;\/Button><\/pre>\n\n\n\n<p>2\u3001\u5728Java\u754c\u9762\u91cc\u83b7\u53d6\u6587\u672c\u6846\u548c\u6309\u94ae\u7684ID\u503c<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u6587\u672c\u6846id\u503c\n EditText editText=findViewById(R.id.edit1);\n EditText editText1=findViewById(R.id.edit2);\n\/\/\u6309\u94aeid\u503c\n Button button=findViewById(R.id.bottom);<\/pre>\n\n\n\n<p>3\u3001\u8bbe\u7f6e\u6309\u94ae\u7684\u5355\u51fb\u503c\uff0c\u628a\u4ee5\u4e0b\u4ee3\u7801\u52a0\u5165\u8fdb\u53bb\u3002\u4e4b\u524d\u7684\u6587\u7ae0\u4e5f\u6709\u8bf4\u8fc7\u4e86\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"> \/\/\u83b7\u53d6\u6587\u672c\u6846\u7684\u503c\n String inputText_name = editText.getText().toString();\n String inputText_pass = editText1.getText().toString();<\/pre>\n\n\n\n<p>4\u3001\u518dif\u5224\u65ad\u8d26\u53f7\u5bc6\u7801\u662f\u5426\u6b63\u786e<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/\u8d26\u53f7\u5bc6\u7801\u90fd\u662f12345\nif (inputText_name.equals(\"12345\")&amp;&amp;inputText_pass.equals(\"12345\")){\n                  Toast.makeText(MainActivity.this,\"\u8d26\u53f7\u5bc6\u7801\u6b63\u786e\",Toast.LENGTH_LONG).show();\n              }else {\n                  Toast.makeText(MainActivity.this,\"\u8d26\u53f7\u6216\u5bc6\u7801\u9519\u8bef\",Toast.LENGTH_LONG).show();\n              }\n            }<\/pre>\n\n\n\n<p>5\u3001\u5b8c\u6574\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">        \/\/\u6587\u672c\u6846id\u503c\n        EditText editText=findViewById(R.id.edit1);\n        EditText editText1=findViewById(R.id.edit2);\n        \/\/\u6309\u94aeid\u503c\n        Button button=findViewById(R.id.bottom);\n        button.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View view) {\n              String inputText_name = editText.getText().toString();\n              String inputText_pass = editText1.getText().toString();\n              if (inputText_name.equals(\"12345\")&amp;&amp;inputText_pass.equals(\"12345\")){\n                  Toast.makeText(MainActivity.this,\"\u8d26\u53f7\u5bc6\u7801\u6b63\u786e\",Toast.LENGTH_LONG).show();\n              }else {\n                  Toast.makeText(MainActivity.this,\"\u8d26\u53f7\u6216\u5bc6\u7801\u9519\u8bef\",Toast.LENGTH_LONG).show();\n              }\n            }\n        });<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6548\u679c\u56fe \u8fd9\u91cc\u662f\u7528\u672c\u5730\u7684\u8d26\u53f7\u5bc6\u7801\u6765\u5b9e\u73b0\u767b\u5f55\u7684\uff0c\u5982\u679c\u6709\u9700\u8981\u518d\u81ea\u5df1\u5bf9\u63a5\u670d\u52a1\u5668\u5373\u53ef 1\u3001\u5148\u5728xml\u6587\u4ef6\u52a0\u5165\u4ee5\u4e0b\u4ee3\u7801 2\u3001\u5728Java\u754c\u9762\u91cc\u83b7\u53d6\u6587\u672c\u6846\u548c\u6309\u94ae\u7684ID\u503c 3\u3001\u8bbe\u7f6e\u6309\u94ae\u7684\u5355\u51fb\u503c\uff0c\u628a\u4ee5\u4e0b\u4ee3\u7801\u52a0\u5165\u8fdb\u53bb\u3002\u4e4b\u524d\u7684\u6587\u7ae0\u4e5f\u6709\u8bf4\u8fc7\u4e86\u3002 4\u3001\u518dif\u5224\u65ad\u8d26\u53f7\u5bc6\u7801\u662f\u5426\u6b63\u786e 5\u3001\u5b8c\u6574\u4ee3\u7801\uff1a<\/p>\n","protected":false},"author":1,"featured_media":190,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-189","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android"],"_links":{"self":[{"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/posts\/189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/comments?post=189"}],"version-history":[{"count":2,"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"predecessor-version":[{"id":192,"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/posts\/189\/revisions\/192"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/media\/190"}],"wp:attachment":[{"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nhl520.cn\/index.php\/wp-json\/wp\/v2\/tags?post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}