{"id":31326,"date":"2023-10-18T12:01:25","date_gmt":"2023-10-18T04:01:25","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=31326"},"modified":"2023-10-18T12:01:25","modified_gmt":"2023-10-18T04:01:25","slug":"android-alertdialog%e5%b0%81%e8%a3%85%e6%93%8d%e4%bd%9c%e6%b5%81%e7%a8%8b%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/31326\/","title":{"rendered":"android alertdialog\u5c01\u88c5\u64cd\u4f5c\u6d41\u7a0b\u4ecb\u7ecd"},"content":{"rendered":"<p>AlertDialog\u662f<span class=\"wpcom_keyword_link\"><a href=\"https:\/\/android.yimenapp.com\" title=\"Android\u5f00\u53d1\u4ece\u4e00\u95e8\u5f00\u59cb\">Android\u5f00\u53d1<\/a><\/span>\u4e2d\u5e38\u7528\u7684\u4e00\u79cd\u5f39\u7a97\u63a7\u4ef6\uff0c\u5b83\u53ef\u4ee5\u7528\u4e8e\u63d0\u793a\u7528\u6237\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u64cd\u4f5c\uff0c\u6216\u8005\u5c55\u793a\u4e00\u4e9b\u4fe1\u606f\u3002\u5728Android\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u4f7f\u7528AlertDialog\u6765\u4e0e\u7528\u6237\u8fdb\u884c\u4ea4\u4e92\u3002\u672c\u6587\u5c06\u4ecb\u7ecdAlertDialog\u7684\u5c01\u88c5\u539f\u7406\u548c\u8be6\u7ec6\u4ecb\u7ecd\u3002<\/p>\n<p>AlertDialog\u7684\u5c01\u88c5\u539f\u7406<\/p>\n<p>AlertDialog\u7684\u5c01\u88c5\u4e3b\u8981\u662f\u901a\u8fc7\u81ea<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e5%ae%9a%e4%b9%89\/\" title=\"\u5b9a\u4e49\" target=\"_blank\">\u5b9a\u4e49<\/a><\/span>Dialog\u7c7b\u6765\u5b9e\u73b0\u3002\u5728Android\u4e2d\uff0cDialog\u662f\u4e00\u4e2a\u62bd\u8c61\u7c7b\uff0c\u6211\u4eec\u65e0\u6cd5\u76f4\u63a5\u4f7f\u7528\u5b83\uff0c\u56e0\u6b64\u9700\u8981\u81ea\u5b9a\u4e49\u4e00\u4e2a\u7c7b\u6765\u7ee7\u627fDialog\uff0c\u5e76\u5728\u8be5\u7c7b\u4e2d\u5b9e\u73b0Alert<\/p>\n<p><figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/31\/15\/18515473874.jpg\" \/><\/figure><\/p>\n<p>Dialog\u7684\u76f8\u5173\u529f\u80fd\u3002<\/p>\n<p>\u5728\u81ea\u5b9a\u4e49Dialog\u7c7b\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5b9a\u4e49\u4e00\u4e9b\u5e03\u5c40\u6587\u4ef6\u548c\u53d8\u91cf\uff0c\u7528\u4e8e\u63a7\u5236AlertDialog\u7684\u5916\u89c2\u548c\u884c\u4e3a\u3002\u4f8b\u5982\uff0c<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e6%88%91%e4%bb%ac%e5%8f%af%e4%bb%a5\/\" title=\"\u6211\u4eec\u53ef\u4ee5\" target=\"_blank\">\u6211\u4eec\u53ef\u4ee5<\/a><\/span>\u5b9a\u4e49\u4e00\u4e2a\u5e03\u5c40\u6587\u4ef6\u6765\u8bbe\u7f6eAlertDialog\u7684\u6837\u5f0f\uff0c\u6216\u8005\u5b9a\u4e49\u4e00\u4e9b\u53d8\u91cf\u6765\u63a7\u5236AlertDialog\u4e2d\u7684\u6309\u94ae\u884c\u4e3a\u3002<\/p>\n<p>\u5728\u81ea\u5b9a\u4e49Dialog\u7c7b\u4e2d\uff0c\u6211\u4eec\u8fd8\u9700\u8981\u5b9e\u73b0\u4e00\u4e9b<span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/%e6%96%b9%e6%b3%95%e6%9d%a5\/\" title=\"\u65b9\u6cd5\u6765\" target=\"_blank\">\u65b9\u6cd5\u6765<\/a><\/span>\u63a7\u5236AlertDialog\u7684\u663e\u793a\u548c\u9690\u85cf\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9e\u73b0\u4e00\u4e2ashow()\u65b9\u6cd5\u6765\u663e\u793aAlertDialog\uff0c\u6216\u8005\u5b9e\u73b0\u4e00\u4e2adismiss()\u65b9\u6cd5\u6765\u9690\u85cfAlertDialog\u3002<\/p>\n<p>AlertDialog\u7684\u5c01\u88c5\u8be6\u7ec6\u4ecb\u7ecd<\/p>\n<p>AlertDialog\u7684\u5c01\u88c5\u9700\u8981\u5b9e\u73b0\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a<\/p>\n<p>1. \u5b9a\u4e49AlertDialog\u7684\u5e03\u5c40\u6587\u4ef6<\/p>\n<p>\u5728\u5e03\u5c40\u6587\u4ef6\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5b9a\u4e49AlertDialog\u7684\u6837\u5f0f\u548c\u63a7\u4ef6\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9a\u4e49\u4e00\u4e2aTextView\u6765\u663e\u793aAlertDialog\u7684\u63d0\u793a\u4fe1\u606f\uff0c\u6216\u8005\u5b9a\u4e49\u4e00\u4e2aButton\u6765\u63a7\u5236AlertDialog\u7684\u884c\u4e3a\u3002<\/p>\n<p>2. \u5b9a\u4e49AlertDialog\u7684\u53d8\u91cf<\/p>\n<p>\u5728\u81ea\u5b9a\u4e49Dialog\u7c7b\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5b9a\u4e49\u4e00\u4e9b\u53d8\u91cf\u6765\u63a7\u5236AlertDialog\u7684\u5916\u89c2\u548c\u884c\u4e3a\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9a<a href=\"https:\/\/www.yimenapp.net\/dabao-4119.html\">android xui<\/a>\u4e49\u4e00\u4e2a\u53d8\u91cf\u6765\u4fdd\u5b58AlertDialog\u7684\u63d0\u793a\u4fe1\u606f\uff0c\u6216\u8005\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\u6765\u4fdd\u5b58AlertDialog\u7684\u6309\u94ae\u884c\u4e3a\u3002<\/p>\n<p>3. \u5b9e\u73b0AlertDialog\u7684\u6784\u9020\u65b9\u6cd5<\/p>\n<p>\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u521d\u59cb\u5316AlertDialog\u7684\u5e03\u5c40\u6587\u4ef6\u548c\u53d8\u91cf\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528LayoutInflater\u6765\u52a0\u8f7d\u5e03\u5c40\u6587\u4ef6\uff0c\u6216\u8005\u4f7f\u7528findViewById()\u65b9\u6cd5\u6765\u83b7\u53d6\u5e03\u5c40\u6587\u4ef6\u4e2d\u7684\u63a7\u4ef6\u3002<\/p>\n<p>4. \u5b9e\u73b0AlertDialog\u7684show()\u65b9\u6cd5<\/p>\n<p>\u5728show()\u65b9\u6cd5\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u663e\u793aAlertDialog\uff0c\u5e76\u8bbe\u7f6e\u5b83\u7684\u6837\u5f0f\u548c\u884c\u4e3a\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528setConte<a href=\"https:\/\/www.yimenapp.net\/dabao-3965.html\">android\u7cfb\u7edf\u5f00\u53d1\u4f18\u70b9<\/a>ntView()\u65b9\u6cd5\u6765\u8bbe\u7f6eAlertDialog\u7684\u5e03\u5c40\u6587\u4ef6\uff0c\u6216\u8005\u4f7f\u7528setCancelable()\u65b9\u6cd5\u6765\u63a7\u5236AlertDialog\u662f\u5426\u53ef\u4ee5\u53d6\u6d88\u3002<\/p>\n<p>5. \u5b9e\u73b0AlertDialog\u7684dismiss()\u65b9\u6cd5<\/p>\n<p>\u5728dismiss()\u65b9\u6cd5\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u9690\u85cfAlertDialog\uff0c\u5e76\u6e05\u9664\u5b83\u7684\u6837\u5f0f\u548c\u884c\u4e3a\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528dismiss()\u65b9\u6cd5\u6765\u9690\u85cfAlertDialog\uff0c\u6216\u8005\u4f7f\u7528setContentView(null)\u65b9\u6cd5\u6765\u6e05\u9664AlertDialog\u7684\u5e03\u5c40\u6587\u4ef6\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fAlertDialog\u7684\u5c01\u88c5\u539f\u7406\u548c\u8be6\u7ec6\u4ecb\u7ecd\u3002\u901a\u8fc7\u81ea\u5b9a\u4e49Dialog\u7c7b\u548c\u5b9e\u73b0\u76f8\u5173\u65b9\u6cd5\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u5c01\u88c5\u4e00\u4e2aAlertDialog\uff0c\u5e76\u5728Android\u5e94\u7528\u4e2d\u4f7f\u7528\u5b83\u6765\u4e0e\u7528\u6237\u8fdb\u884c\u4ea4\u4e92\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AlertDialog\u662fAndroid\u5f00\u53d1\u4e2d\u5e38\u7528\u7684\u4e00\u79cd\u5f39\u7a97\u63a7\u4ef6\uff0c\u5b83\u53ef\u4ee5\u7528\u4e8e\u63d0\u793a\u7528\u6237\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u64cd\u4f5c\uff0c\u6216\u8005\u5c55\u793a\u4e00\u4e9b\u4fe1\u606f\u3002\u5728Android\u5e94\u7528\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u4f7f\u7528AlertDialog\u6765\u4e0e\u7528\u6237\u8fdb\u884c\u4ea4\u4e92\u3002<\/p>\n","protected":false},"author":22,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[29689,23464,10381,8936,29690],"special":[],"attr":[],"class_list":["post-31326","post","type-post","status-publish","format-standard","hentry","category-www","tag-ios-app","tag-vue-h5apk","tag-10381","tag-8936","tag-29690","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/31326","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/comments?post=31326"}],"version-history":[{"count":0,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/31326\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=31326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=31326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=31326"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=31326"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=31326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}