{"id":218,"date":"2016-08-24T15:26:54","date_gmt":"2016-08-24T07:26:54","guid":{"rendered":"http:\/\/www.prayerlaputa.com\/?p=218"},"modified":"2016-08-24T15:26:54","modified_gmt":"2016-08-24T07:26:54","slug":"android%e5%bc%80%e5%90%af%e8%be%85%e5%8a%a9%e5%8a%9f%e8%83%bd%e5%90%8egridview%e6%8e%a7%e4%bb%b6%e5%af%bc%e8%87%b4app%e9%97%aa%e9%80%80","status":"publish","type":"post","link":"http:\/\/prayerlaputa.com\/?p=218","title":{"rendered":"android\u5f00\u542f\u8f85\u52a9\u529f\u80fd\u540eGridView\u63a7\u4ef6\u5bfc\u81f4app\u95ea\u9000"},"content":{"rendered":"<p>app\u4e0a\u7ebf\u524d\u9047\u5230\u4e00\u4e2a\u5f88\u8be1\u5f02\u7684\u95ee\u9898\uff0c\u540c\u4e00\u6b3e\u578b\u53f7\u7684\u624b\u673a\uff0c\u4e00\u53f0\u624b\u673a\u6ca1\u95ee\u9898\uff0c\u53e6\u4e00\u53f0\u624b\u673a\u5219\u5728\u663e\u793a\u9996\u9875\u540e\u5047\u6b7b\u3001\u7136\u540e\u76f4\u63a5\u95ea\u9000\u3002\u7ecf\u8fc7\u6392\u67e5\uff0c\u786e\u5b9a\u662f\u81ea\u5b9a\u4e49GridView\u60f9\u7684\u7978\uff0c\u5f02\u5e38\u4fe1\u606f\u5982\u4e0b\uff1a<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\n java.lang.IllegalArgumentException: parameter must be a descendant of this view\n at android.view.ViewGroup.offsetRectBetweenParentAndChild(ViewGroup.java:5353)\n at android.view.ViewGroup.offsetDescendantRectToMyCoords(ViewGroup.java:5282)\n at android.view.ViewGroup$ViewLocationHolder.init(ViewGroup.java:7755)\n at android.view.ViewGroup$ViewLocationHolder.obtain(ViewGroup.java:7689)\n at android.view.ViewGroup$ChildListForAccessibility.init(ViewGroup.java:7624)\n at android.view.ViewGroup$ChildListForAccessibility.obtain(ViewGroup.java:7592)\n at android.view.ViewGroup.addChildrenForAccessibility(ViewGroup.java:1927)\n at android.view.ViewGroup.onInitializeAccessibilityNodeInfoInternal(ViewGroup.java:2982)\n at android.widget.AdapterView.onInitializeAccessibilityNodeInfoInternal(AdapterView.java:983)\n at android.widget.AbsListView.onInitializeAccessibilityNodeInfoInternal(AbsListView.java:1509)\n at android.widget.GridView.onInitializeAccessibilityNodeInfoInternal(GridView.java:2361)\n at android.view.View.onInitializeAccessibilityNodeInfo(View.java:6151)\n at android.view.View.createAccessibilityNodeInfoInternal(View.java:6110)\n at android.view.View.createAccessibilityNodeInfo(View.java:6095)\n at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:145)\n at android.view.accessibility.AccessibilityRecord.setSource(AccessibilityRecord.java:119)\n at android.view.View.onInitializeAccessibilityEventInternal(View.java:6047)\n at android.widget.AdapterView.onInitializeAccessibilityEventInternal(AdapterView.java:994)\n at android.view.View.onInitializeAccessibilityEvent(View.java:6035)\n at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:5896)\n at android.view.View.sendAccessibilityEventUnchecked(View.java:5881)\n at android.view.View$SendViewStateChangedAccessibilityEvent.run(View.java:22468)\n at android.os.Handler.handleCallback(Handler.java:743)\n at android.os.Handler.dispatchMessage(Handler.java:95)\n at android.os.Looper.loop(Looper.java:150)\n at android.app.ActivityThread.main(ActivityThread.java:5546)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)\n<\/pre>\n<p><!--more--><br \/>\n\u76f4\u63a5\u5728\u7f51\u4e0a\u641c\u8fd9\u4e2a\u5f02\u5e38\u4fe1\u606f\uff0c\u4f1a\u51fa\u6765\u7c7b\u4f3c\u7684\u95ee\u9898\uff0c\u6bd4\u5982<a href=\"http:\/\/stackoverflow.com\/questions\/26752161\/illegalargumentexception-parameter-must-be-a-descendant-of-this-view-at-viewgrou\">\u8fd9\u4e2a\u5e16\u5b50<\/a>\uff0c\u8fd9\u4e9b\u5e16\u5b50\u7ed9\u51fa\u7684\u5f02\u5e38\u4fe1\u606f\u76f8\u4f3c\uff0c\u6700\u540e\u7ed9\u51fa\u7684\u89e3\u51b3\u65b9\u6848\u4e5f\u7c7b\u4f3c\uff0c\u90fd\u662f\u8bf4\u7126\u70b9\u95ee\u9898\uff0c\u53ea\u8981\u8c03\u7528clearFocus\u5c31\u53ef\u4ee5\u4e86\uff08\u8fd9\u4e2a\u6e05\u695a\u7126\u70b9\u7684\u64cd\u4f5c\u53ef\u4ee5\u5728\u591a\u4e2a\u5730\u65b9\u8fdb\u884c\uff09\uff0c\u4f46\u6211\u90fd\u8bd5\u8fc7\uff0c\u53d1\u73b0\u8fd9\u4e9b\u65b9\u6cd5\u90fd\u6ca1\u6cd5\u89e3\u51b3\u6211\u9047\u5230\u7684\u95ee\u9898\u3002\u540e\u6765\u901a\u8fc7\u540c\u4e8b\u8bd5\u7528app\u53cd\u9988\uff0c\u53d1\u73b0\u53ea\u8981\u6253\u5f00android\u7cfb\u7edf\u7684\u8f85\u52a9\u529f\u80fd\uff08android\u00a0accessibility \u6bd4\u5982\u5f00\u5173\u63a7\u5236\u3001\u653e\u5927\u624b\u52bf\u4e4b\u7c7b\u7684\uff0c\u4e0d\u540c\u624b\u673a\u83dc\u5355\u540d\u53ef\u80fd\u4e0d\u4e00\u6837\uff0c\u6bd4\u5982MIUI\u4e2d\u662f\u5728\u201c\u65e0\u969c\u788d\u201d\u4e2d\u7684\u90a3\u4e9b\u529f\u80fd\uff09\uff0c\u5c31\u4f1a\u51fa\u73b0\u8fd9\u4e2a\u95ee\u9898\u3002\u7136\u540e\u91cd\u65b0\u641c\uff0c\u53d1\u73b0\u662f\u201c\u68c0\u6d4b\u7a97\u53e3\u5185\u5bb9\uff08\u68c0\u67e5\u60a8\u6b63\u4e0e\u5176\u4ed6\u4e92\u52a8\u7684\u7a97\u53e3\u7684\u5185\u5bb9\uff09\u201d\u8fd9\u4e2a\u529f\u80fd\u5bfc\u81f4\u7684\uff0c\u5728React\u9879\u76ee\u4e5f\u5b58\u5728\u8be5\u95ee\u9898\uff0c\u53c2\u8003\u5982\u4e0b\u94fe\u63a5 <a href=\"https:\/\/github.com\/facebook\/react-native\/commit\/57c40d9a6f5a901cf108b72ab18f4bae9fc246e2#diff-6453d554bf967fe816a1aa3735c9fe62\">\u4f20\u9001\u95e8<\/a>\u00a0 \u4ee5\u6211\u7684\u4f7f\u7528\u573a\u666f\u4e3a\u4f8b\uff0c\u5728\u6211\u4fee\u6539GridView\u540e\uff0c\u6dfb\u52a0view\u4f3c\u4e4e\u5e76\u4e0d\u662f\u50cf\u5176\u4ed6\u63a7\u4ef6\u90a3\u6837\uff0c\u628a\u65b0\u6dfb\u52a0\u7684View\u52a0\u5230\u6574\u4e2aViewTree\u4e2d\uff0c\u800c\u4f7f\u7528\u8f85\u52a9\u529f\u80fd\u65f6\uff0c\u9700\u8981\u4eceViewTree\u7684\u6839\u904d\u5386\u5230\u6240\u6709\u53f6\u5b50View\uff0c\u5230GridView\u8fd9\u4e00\u5c42\u6ca1\u6cd5\u5f80\u4e0b\u8d70\uff0c\u624d\u5bfc\u81f4\u4e86\u4e0a\u8ff0\u95ee\u9898\u3002\u5b9e\u9645\u4e0a\uff0c\u770b\u5f02\u5e38\u4e5f\u53ef\u4ee5\u770b\u5230\u662f\u5728\u6d89\u53caaccessibility\u76f8\u5173\u65b9\u6cd5\u65f6\u51fa\u9519\uff0c\u6240\u4ee5\u53ea\u8981\u5728GridView\u4e2d\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\u5373\u53ef\u89e3\u51b3\uff1a<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\n @Override\n public void addChildrenForAccessibility(ArrayList&lt;View&gt; outChildren) {\n \/\/ Explicitly override this to prevent accessibility events being passed down to children\n \/\/ Those will be handled by the mHostView which lives in the dialog\n }\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>app\u4e0a\u7ebf\u524d\u9047\u5230\u4e00\u4e2a\u5f88\u8be1\u5f02\u7684\u95ee\u9898\uff0c\u540c\u4e00\u6b3e\u578b\u53f7\u7684\u624b\u673a\uff0c\u4e00\u53f0\u624b\u673a\u6ca1\u95ee\u9898\uff0c\u53e6\u4e00\u53f0\u624b\u673a\u5219\u5728\u663e\u793a\u9996\u9875\u540e\u5047\u6b7b\u3001\u7136\u540e\u76f4\u63a5\u95ea\u9000 <a href='http:\/\/prayerlaputa.com\/?p=218' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[2,6],"tags":[26,33],"_links":{"self":[{"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/posts\/218"}],"collection":[{"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=218"}],"version-history":[{"count":0,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=\/wp\/v2\/posts\/218\/revisions"}],"wp:attachment":[{"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=218"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/prayerlaputa.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}