{"id":1029,"date":"2013-02-25T19:22:53","date_gmt":"2013-02-25T10:22:53","guid":{"rendered":"https:\/\/ecoop.net\/memo\/?p=1029"},"modified":"2018-11-21T18:53:01","modified_gmt":"2018-11-21T09:53:01","slug":"android_backgrtound-image-repeat","status":"publish","type":"post","link":"https:\/\/www.ecoop.net\/memo\/archives\/android_backgrtound-image-repeat.html","title":{"rendered":"\u3010Android\u3011\u80cc\u666f\u753b\u50cf\u306e\u30ea\u30d4\u30fc\u30c8\u304c\u52b9\u304b\u306a\u3044\u554f\u984c"},"content":{"rendered":"<p>\u753b\u50cf\u306e\u30b3\u30b9\u30c8\u3092\u4e0b\u3052\u308b\u305f\u3081\u306b\u3001\u80cc\u666f\u753b\u50cf\u306b tileMode=&#8221;repeat&#8221; \u3092\u6307\u5b9a\u3057\u3066\u30bf\u30a4\u30eb\u3068\u3057\u3066\u4f7f\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001<br \/>\nAndroid 2.3 \u7cfb\u4ee5\u4e0b\u306e\u7aef\u672b\u3067\u7279\u5b9a\u306e\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3067\u3060\u3051\u30ea\u30d4\u30fc\u30c8\u304c\u805e\u304b\u306a\u304f\u3066\u30cf\u30de\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3069\u3046\u3084\u3089\u30cf\u30cb\u30ab\u30e0\u3067\u4fee\u6b63\u3055\u308c\u305fOS\u306e\u4e0d\u5177\u5408\u3060\u305d\u3046\u3067\u2026\u4ee5\u4e0b\u5bfe\u7b56\u304c\u308f\u304b\u3063\u305f\u306e\u3067\u30e1\u30e2\u3002<!--more--><\/p>\n<h2>\u3069\u3046\u3044\u3046\u72b6\u6cc1\uff1f<\/h2>\n<p>\u30bf\u30a4\u30eb\u80cc\u666f(bg.xml)\u306f\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!-- res\/drawable\/bg.xml --&gt;\r\n&lt; ?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n&lt;bitmap xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\r\n    android:antialias=&quot;true&quot;\r\n    android:dither=&quot;false&quot;\r\n    android:filter=&quot;false&quot;\r\n    android:gravity=&quot;fill&quot;\r\n    android:src=&quot;@drawable\/bg_repeat&quot;\r\n    android:tileMode=&quot;repeat&quot;&gt;&lt;\/bitmap&gt;\r\n<\/pre>\n<p>\u3053\u308c\u3092\u5404\u30ec\u30a4\u30a2\u30a6\u30c8\u3067\u6b21\u306e\u3088\u3046\u306b\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt; ?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n&lt;relativelayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\r\n    android:layout_width=&quot;match_parent&quot;\r\n    android:layout_height=&quot;match_parent&quot;\r\n    android:background=&quot;@drawable\/bg&quot; &gt;\r\n<\/pre>\n<p>\u30ea\u30d4\u30fc\u30c8\u304c\u52b9\u304f\u753b\u9762\u3082\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u52b9\u304b\u306a\u3044\u753b\u9762\u3067\u306f\u4f38\u3073\u305f\u30bf\u30a4\u30eb\u753b\u50cf\u304c<br \/>\n\uff11\u679a\u3060\u3051\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u3053\u308c\u306f\u304b\u3063\u3053\u60aa\u3044\u3002<\/p>\n<h2>\u76f4\u3057\u65b9\u306f\uff1f<\/h2>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/4077487\/background-image-not-repeating-in-android-layout\">StackOverFlow(background image not repeating in android layout)<\/a>\u306b\u66f8\u304b\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u9069\u5b9c\u3001\u63cf\u753b\u306e\u66f4\u65b0\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u30ea\u30d4\u30fc\u30c8\u3092\u884c\u306a\u3063\u3066\u3044\u308b\u30d3\u30e5\u30fc\u306b\u5bfe\u3057\u3066\u5b9f\u884c\u3059\u308b\u3068\u3044\u3044\u3088\u3046\u3067\u3059\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic static void fixBackgroundRepeat(View view) {\r\n      Drawable bg = view.getBackground();\r\n      if(bg != null) {\r\n           if(bg instanceof BitmapDrawable) {\r\n                BitmapDrawable bmp = (BitmapDrawable) bg;\r\n                bmp.mutate(); \/\/ make sure that we aren&#039;t sharing state anymore\r\n                bmp.setTileModeXY(TileMode.REPEAT, TileMode.REPEAT);\r\n           }\r\n      }\r\n }\r\n<\/pre>\n<p>\u753b\u9762\u80cc\u666f\u306e\u30ea\u30d4\u30fc\u30c8\u3092\u4fee\u6b63\u3059\u308b\u306a\u3089\u3053\u306e\u3088\u3046\u306b\u5b9f\u884c\u3059\u308c\u3070\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nfixBackgroundRepeat(this.findViewById(android.R.id.content)\r\n\t\t\t\t.getRootView());\r\n<\/pre>\n<h2>\u3069\u3046\u3057\u3066\u3053\u3046\u306a\u3063\u305f<\/h2>\n<p>StackOverFlow\u306e\u30b3\u30e1\u30f3\u30c8\u306b\u3088\u308b\u3068\u3001\u30cf\u30cb\u30ab\u30e0(Android 3.0)\u3067\u4fee\u6b63\u3055\u308c\u305f\u4e0d\u5177\u5408\u306e\u3088\u3046\u3067\u3001\u540c\u3058\u753b\u9762\u3067BitmapDrawable\u304c\u591a\u6570\u4f7f\u308f\u308c\u3066\u3044\u308b\u3068\u3001\u5185\u90e8\u3067\u306eBitmap(\u3068Bitmap\u306e\u72b6\u614b\u8a2d\u5b9a)\u306e\u518d\u5229\u7528\u306e\u30bf\u30a4\u30df\u30f3\u30b0\u3067tileMode\u8a2d\u5b9a\u304c\u7c21\u5358\u306b\u5931\u308f\u308c\u3066\u3057\u307e\u3046\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u5bfe\u7b56\u3067\u884c\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3001\u6d88\u3048\u3066\u3057\u307e\u3063\u305f\u80cc\u666f\u753b\u50cf\u306e\u30ea\u30d4\u30fc\u30c8\u8a2d\u5b9a\u3092\u518d\u5ea6\u8a2d\u5b9a\u3057\u76f4\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u306d\u3002<\/relativelayout><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u753b\u50cf\u306e\u30b3\u30b9\u30c8\u3092\u4e0b\u3052\u308b\u305f\u3081\u306b\u3001\u80cc\u666f\u753b\u50cf\u306b tileMode=&#8221;repeat&#8221; \u3092\u6307\u5b9a\u3057\u3066\u30bf\u30a4\u30eb\u3068\u3057\u3066\u4f7f\u3063\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001 Android 2.3 \u7cfb\u4ee5\u4e0b\u306e\u7aef\u672b\u3067\u7279\u5b9a\u306e\u30a2\u30af\u30c6\u30a3\u30d3\u30c6\u30a3\u3067\u3060\u3051\u30ea\u30d4\u30fc\u30c8\u304c\u805e &hellip; <a href=\"https:\/\/www.ecoop.net\/memo\/archives\/android_backgrtound-image-repeat.html\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u3010Android\u3011\u80cc\u666f\u753b\u50cf\u306e\u30ea\u30d4\u30fc\u30c8\u304c\u52b9\u304b\u306a\u3044\u554f\u984c<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85],"tags":[65],"class_list":["post-1029","post","type-post","status-publish","format-standard","hentry","category-android-dev","tag-android"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/1029","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/comments?post=1029"}],"version-history":[{"count":0,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/1029\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/media?parent=1029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/categories?post=1029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/tags?post=1029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}