{"id":939,"date":"2023-03-11T18:47:08","date_gmt":"2023-03-11T10:47:08","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=939"},"modified":"2023-04-29T15:43:02","modified_gmt":"2023-04-29T07:43:02","slug":"android-solve-frame-animation-oom-component-frameanimdrawable","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/11\/android-solve-frame-animation-oom-component-frameanimdrawable\/","title":{"rendered":"Android\u89e3\u51b3\u5e27\u52a8\u753bOOM\u7684\u7ec4\u4ef6FrameAnimDrawable"},"content":{"rendered":"<h2>FrameAnimDrawable\u548cAnimationDrawable\u7684\u5173\u7cfb<\/h2>\n<ul>\n<li>AnimationDrawable\uff1a\u7cfb\u7edf\u5b9e\u73b0\u5e27\u52a8\u753b\u7684Drawable\uff0c\u4f7f\u7528\u7b80\u5355\uff0c\u4f46\u5185\u5b58\u6d88\u8017\u5927\uff0c\u52a8\u753b\u5e27\u4e00\u591a\u5c31\u5bb9\u6613\u51fa\u73b0\u5361\u987f\u751a\u81f3OOM<\/li>\n<li>FrameAnimDrawable\uff1a\u5b9e\u73b0\u52a8\u6001\u52a0\u8f7d\uff0c\u4e00\u6b21\u53ea\u52a0\u8f7d\u5f53\u524d\u52a8\u753b\u5e27\uff0c\u7528\u5b8c\u5373\u91ca\u653e\uff0c\u5185\u5b58\u6d88\u8017\u5c11\uff0c\u964d\u4f4e\u5361\u987f\u548cOOM\u53d1\u751f\u7684\u6982\u7387<\/li>\n<\/ul>\n<p><!-- more --><\/p>\n<p>FrameAnimDrawable\u7684\u51fa\u73b0\u5c31\u4e3a\u66ff\u4ee3AnimationDrawable\u3002<\/p>\n<h2>\u5b9e\u73b0\u601d\u8def<\/h2>\n<p>AnimationDrawable\u4e4b\u6240\u4ee5\u5185\u5b58\u6d88\u8017\u5927\uff0c\u5c31\u662f\u56e0\u4e3a\u5b83\u5728\u52a8\u753b\u524d\u52a0\u8f7d\u4e86\u6240\u6709\u7684\u5e27\u3002\u90a3\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u5728\u52a8\u753b\u8fc7\u7a0b\u4e2d\u52a8\u6001\u52a0\u8f7d\u5462\uff0c\u5e26\u7740\u8fd9\u4e2a\u601d\u8def\u5c31\u6709\u4e86FrameAnimDrawable\u3002<\/p>\n<p>\u4ee3\u7801\u5b9e\u73b0\u5f88\u7b80\u5355\uff0c\u4e09\u6b65\u8d70\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528ValueAnimator\u52a8\u6001\u6539\u53d8\u5e27\u7d22\u5f15<\/li>\n<li>\u8c03\u7528invalidateSelf\u91cd\u7ed8Drawable<\/li>\n<li>\u5728draw\u65b9\u6cd5\u4e2d\u52a0\u8f7d\u5f53\u524d\u5e27\u5e76\u7ed8\u5236\u5230\u753b\u5e03\u4e2d<\/li>\n<\/ul>\n<h2>\u5b9e\u9645\u6548\u679c<\/h2>\n<p>\u52a8\u753b\u6d41\u7545\u65e0\u5361\u987f\uff0c\u5185\u5b58\u6d88\u8017\u4f4e\u3002<\/p>\n<h2>\u5b9e\u6d4b\u5185\u5b58<\/h2>\n<p>\u5206\u522b\u6d4b\u8bd5\u540c\u4e00\u5e8f\u5217\u5e27\uff0c\u4f7f\u7528AnimationDrawable\u548cFrameAnimDrawable\u5728\u5185\u5b58\u65b9\u9762\u7684\u5dee\u5f02\u3002<\/p>\n<p>\u7f51\u4e0a\u627e\u4e8610\u5f20\u56fe\u7247\uff0c\u5206\u8fa8\u7387\u57281000*600\u5de6\u53f3\uff0c\u5206\u522b\u8fd0\u884c\uff0c\u6548\u679c\u90fd\u5dee\u4e0d\u591a\uff0c\u8fd9\u91cc\u8d34\u4e00\u4e2a\u51fa\u6765\u3002<\/p>\n<p>AnimationDrawable\u5360\u7528\u7684\u5185\u5b58\u60c5\u51b5<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Android\/AnimationDrawable\u5185\u5b58\u5360\u7528\u60c5\u51b5.jpg\" alt=\"AnimationDrawable\u5185\u5b58\u5360\u7528\u60c5\u51b5\" \/><\/p>\n<p>FrameAnimDrawable\u5185\u5b58\u5360\u7528\u60c5\u51b5<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/Android\/FrameAnimDrawable\u5185\u5b58\u5360\u7528\u60c5\u51b5.jpg\" alt=\"FrameAnimDrawable\u5185\u5b58\u5360\u7528\u60c5\u51b5\" \/><\/p>\n<p>\u603b\u7ed3\u4e0b\uff0cAnimationDrawable\u7531\u4e8e\u9884\u52a0\u8f7d\u6240\u6709\u56fe\u7247\u5230\u5185\u5b58\uff0c\u5176\u7a33\u5b9a\u572890M\u5de6\u53f3\uff1bFrameAnimDrawable\u76f8\u5f53\u4e8e\u61d2\u52a0\u8f7d\uff0c\u5e76\u4e14\u53ca\u65f6\u91ca\u653e\uff1b\u5185\u5b58\u867d\u7136\u4e0a\u4e0b\u6ce2\u52a8\u5389\u5bb3\uff0c\u4f46\u59cb\u7ec8\u7ef4\u6301\u572825M\u5de6\u53f3\u3002<\/p>\n<p>\u4e4b\u524d\u6709\u4f7f\u7528ImageView\u52a8\u6001\u8bbe\u7f6esetImageResource\u6765\u8fbe\u5230\u7c7b\u4f3c\u6548\u679c\uff0c\u5185\u5b58\u4e5f\u63a7\u5236\u7684\u4e0d\u9519\uff0c\u4f46\u5e8f\u5217\u5e27\u5faa\u73af\u64ad\u653e\u7684\u6709\u4e2a\u77ed\u6682\u7684\u7a7a\u767d\uff0c\u81f3\u4eca\u672a\u89e3\u51b3\uff0c\u624d\u6709\u4e86FrameAnimDrawable\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>FrameAnimDrawable\u548cAnimationDrawable\u7684\u5173\u7cfb AnimationDrawabl [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[213],"tags":[256],"class_list":["post-939","post","type-post","status-publish","format-standard","hentry","category-android-performance","tag-oom"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/939","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=939"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/939\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=939"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=939"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=939"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}