{"id":1252,"date":"2023-03-18T09:44:00","date_gmt":"2023-03-18T01:44:00","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1252"},"modified":"2023-04-29T09:29:10","modified_gmt":"2023-04-29T01:29:10","slug":"android-record","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/18\/android-record\/","title":{"rendered":"Android\u8e29\u5751\u8bb0\u5f55"},"content":{"rendered":"<h3>Android RecycleView\u6dfb\u52a0HeaderView\u5bbd\u5ea6\u4e0d\u80fd\u6491\u6ee1\u5c4f\u5e55\u95ee\u9898<\/h3>\n<p>\u4f5c\u4e3aHeaderView\u7684\u6839\u5e03\u5c40\u4e0d\u53ef\u4ee5\u4f7f\u7528LinearLayout\uff0c\u5426\u5219\u5c31\u4f1a\u4ea7\u751f\u4e0a\u8ff0\u7684\u95ee\u9898<\/p>\n<p><!-- more --><\/p>\n<h3>EditText\u8bbe\u7f6einputType\u4e3a\u5bc6\u7801\u4e0d\u80fd\u751f\u6548\u95ee\u9898<\/h3>\n<pre><code class=\"language-java\">\/\/\u8bbe\u7f6e\u5bc6\u6587\u65f6\uff0c\u9700\u8981\u540c\u65f6\u8bbe\u7f6eTYPE_CLASS_TEXT\u624d\u80fd\u751f\u6548\neditText.setInputType(isPassword ? \n                    InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD : \n                    InputType.TYPE_CLASS_TEXT);<\/code><\/pre>\n<h3>RecyclerView IndexOutOfBoundsException: Inconsistency detected<\/h3>\n<p>RecyclerView\u4e0b\u62c9\u5237\u65b0\u62a5\u9519\uff1a<\/p>\n<pre><code>java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 10(offset:10).state:15<\/code><\/pre>\n<p>\u62a5\u9519\u539f\u56e0\uff1aRecyclerView\u6570\u636e\u6e90\u4fee\u6539\u540e\uff0c\u6ca1\u53ca\u65f6\u901a\u77e5Adapter\u66f4\u65b0\u6570\u636e<\/p>\n<p>\u89e3\u51b3\u529e\u6cd5\uff1a\u5728\u6570\u636e\u6e90\u4fee\u6539\u540e\u53ca\u65f6\u901a\u77e5Adapter\u66f4\u65b0\u6570\u636e<\/p>\n<pre><code class=\"language-java\">mDataList.clear();  \/\/\u6e05\u9664\u6570\u636e\u6e90\nmAdapter.notifyDataSetChanged();  \/\/\u53ca\u65f6\u901a\u77e5Adapter\u66f4\u65b0\u6570\u636e<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Android RecycleView\u6dfb\u52a0HeaderView\u5bbd\u5ea6\u4e0d\u80fd\u6491\u6ee1\u5c4f\u5e55\u95ee\u9898 \u4f5c\u4e3aHeaderView\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[311],"tags":[],"class_list":["post-1252","post","type-post","status-publish","format-standard","hentry","category-android-advance"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1252","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1252"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1252\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1252"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1252"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1252"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}