9patchãè¦ãããï¼
è§ä¸¸ã綺éºã«è¡¨ç¤ºãããªãï¼
ãã¿ã³ãä½ãã¾ããï¼
è§ä¸¸ã®ãã¿ã³ã§ãã
æ©éãã¿ã³ã®èæ¯ã«è¨å®ãã¾ããã
ãªãã¦ãã£ãã
è¨å®ãããã¿ã³ã大ãããã¦èæ¯ç»åãå¼ã伸ã°ããã¦ãã¾ãã¾ãã
9patchã使ããï¼
ããã§9patchã®åºçªã§ãã
9patchã¯ãç»åããã¢ãã大ããã£ãå ´åï¼ä»åã¯ç»åãããã¿ã³ã大ããã£ãï¼
å¼ã伸ã°ãé¨åãæå®ãããã¨ã§ãç»åã®å´©ããç¡ããäºãã§ããã®ã§ãï¼
Fireworksã§ããæã®9ã¹ã©ã¤ã¹ã¨ããæ©è½ã«ä¼¼ã¦ãã¾ãã
å
ã»ã©ã®ãã¿ã³ç»åã«9patchã®å¦çãæ½ãã¦ã¿ã¾ãã
ã§ãã¾ããï¼
ä¸å´ã¨å·¦å´ã«é»ã1ãã¯ã»ã«ãè¦ãã¾ãã§ããããï¼
ã¡ãã£ã¨æ¡å¤§ãã¾ãã
æ¡å¤§ããã®ã§ãã±ã¦ã¾ããããããªãåããã¾ããã
9patchã¯ä¸ä¸å·¦å³ã«ãã¢ã«ãã¡ç¡ãã®é»(#000000)ã®å°ãä»ãããã¨ã§ä¼¸ã°ãé¨åãæå®ãã¾ãã
ä¸ä¸å·¦å³ããããæå³ãããã¾ãã
ä¸ã¨å·¦ã®å°ã¯å¿
é ã§ãã
ä¸ã¨å³ã®å°ã¯çç¥ãããã¨ãã§ãã¾ãã
ä¸ã¨å³ã®å°ã®èª¬æã¯å¾ã§ããã¾ãã
å³è§£9patch
ããã»ã©ã®ç»åã解説ããã¨
ä¸ã«æå®ãããã¯ã»ã«ã®å(赤)ã
横ã«ä¼¸ã³ãæã«ã³ãã¼ããã¾ãã
å·¦ã«æå®ãããã¯ã»ã«ã®è¡(é)ã
縦ã«ä¼¸ã³ãæã«ã³ãã¼ããã¾ãã
ãããã£ã¦è§ä¸¸é¨åãæ¡å¤§ãããªãããã«ãã¾ãã
端æ«ã«è¨å®ãã¦ã¿ã¾ãããã
綺éºã«è§ä¸¸ã表示ããã¾ããã
ããã«ãã©ã®é¨åã«ã³ãã¼ããã¦ããã®ã確èªãããããããããªç»åãç¨æãã¦ã¿ã¾ããã
端æ«ã§è¡¨ç¤ºãã¦ã¿ã¾ãããã
ãªãã»ã©ã¼ããã£ãã®ãµã³ãã«ã¿ããã«ã³ãã¼ããã¾ããã
ããã«æåã調ã¹ã
é常9patchã®ä¸ã¨å·¦ã®æå®ã¯1ãã¯ã»ã«ã ãã§æ¸ã¿ã¾ãããå®éã«ã¯è¤æ°ãã¯ã»ã«æå®ãããã¨ãã§ãã¾ãã
端æ«ã§è¡¨ç¤ºããã¦æåãããããã¦ã¿ã¾ãããã
ãã¨ãã°2ãã¯ã»ã«æå®ããå ´åã¯ã©ããªããã§ãããã
端æ«ã§è¡¨ç¤ºãã¦è¦ã¦ã¿ã¾ãã
ååãã¤ã³ãã¼ããã¾ããã
ãããããã§ããã
次ã¯ãããªç»åã¯ã©ãã§ãããã
åã
è¿ãã¨ãããè£ããã§ãããã
ããã«æ´»ç¨ãã
æåãåããã°ããããå©ç¨ãã¾ãã
ãã®ç»åã使ã£ã¦
ãããªé¢¨ã«è¡¨ç¤ºããã*1
ãã®ç»åã使ã£ã¦
ãããªé¢¨ã«è¡¨ç¤ºããã*2
ã°ã©ãã¼ã·ã§ã³ãªãå·¦å´ãã»ã¨ãã©å¡ã£ã¡ãã£ã¦ãããããããªãã§ãããã
段差ãè¦ãã¡ãã£ã¦ã¾ãããå¤å°ã®æ¡å¤§ãªããã¾ããã¾ãã
ãã¿å¡ããªã®ã«ãããã9patchã®æå®ã®ä»æ¹ããã¦ãã人ããã¦ãæ¬å½ã«ç解ãã¦ããã®ããªã¼ã£ã¦å¿é
ã«ãªãã¾ãâ¦ã
ã¡ããã¨è¡¨ç¤ºã¯ããããã ãã©ãâ¦ã
æåãå¤ãªä½ç½®ã«è¡¨ç¤ºããã
ãã¿ã³ã«ã¯ã©ãã«ãå¿
è¦ã§ãã
ãã¿ã³ãæ¼ããæã«ã©ããªæ©è½ãåãã®ãããã©ãã«ã®æåã«ãã£ã¦è¡¨ç¾ãã¾ãããã
ä»åã¯"ããã«ã¡ã¯ï¼"ã¨ããã©ãã«ã«ãã¾ãã
ãã£ã¨æ¼ããã"ã½ã½ã½ã½ã¼ãï¼"ã¨é³ãé³´ãã«éãããã¾ããã
ãã£ãä½ã£ããã¿ã³ã«ã©ãã«ã表示ããããå¤æ´ãã¦ã¿ã¾ãã
ããã«ã¡ã¯ï¼ã£ã¦è¡¨ç¤ºããããã©ãä½ç½®ãããããã§ãã
ä¸ã«è¡¨ç¤ºãã¦ããããã©ã«ãã®ãã¿ã³ã§ã¯ã»ã³ã¿ãªã³ã°ããã¦ããã®ã«ãä»åä½ã£ããã¿ã³ã¯å¤ãªä½ç½®ã«è¡¨ç¤ºããã¦ãã¾ãã
ããã«9patch
ããã9patchã®æ©è½ã使ã£ã¦è§£æ±ºãã¾ãã
ä¸ã¨å·¦ã®å°ã使ãäºã«ãã£ã¦ä¼¸ã°ãé¨åãæå®ãã¾ãããã
ä¸ã¨å³ã®å°ã使ãäºã«ãã£ã¦ã³ã³ãã³ãã®ä½ç½®ãæå®ãããã¨ãã§ãã¾ãã
ãã¿ã³ã®ç»åã«å¯¾ãã¦ã³ã³ãã³ãã®ä½ç½®ãæå®ãã¦ã¿ã¾ãã
ã§ãã¾ããï¼
ä¾ã«ãã£ã¦æ¡å¤§ãã¾ãã
ä¸ã¨å³ã«é»ããã¯ã»ã«ããããããããã¨æãã¾ãã
解説ããã¨
ä¸ã®é»ããã¯ã»ã«ã®å(赤)ã¨
å³ã®é»ããã¯ã»ã«ã®è¡(é)ã®
交ãã£ãå ´æ(ç´«)ãã³ã³ãã³ãã®å
¥ãå ´æã«ãªãã¾ãã
ä»åã ã¨æååã®å
¥ãå ´æã§ãã
端æ«ã§è¡¨ç¤ºãã¦ã¿ã¾ãããã
ã¡ããã¨ã»ã³ã¿ãªã³ã°ããã¾ããã
ãã£ãã®èµ¤/éã®ç»åã§ã表示ãã¦ã¿ã¾ãããã
ã¡ããã¨ç´«ã®ã¨ããã«ã©ãã«ã表示ããã¦ãã¾ãã
ããã«æåãããã¹ã
調ã¹ãããã¨æã£ãã®ã§ãã
ä½ãã§ãã¾ããã
ä¸ã¨å³ã¯ããã§ãã¹ã¦ã¿ããã§ãã
ä¾ãã°ãããªç»åãç¨æãã¦ç«¯æ«ã§è¡¨ç¤ºãã¦ã¿ãããã¨æã£ãã®ã§ãã
eclipseããã«æããã¦ãã¾ããã³ã³ãã¤ã«ãéãã¾ããã
ããã«æ´»ç¨ãã
ãã®ç»åã使ã£ã¦
ãããªé¢¨ã«è¡¨ç¤ºããã
ãã®ç»åã使ã£ã¦
ãããªé¢¨ã«è¡¨ç¤ºãããã§ãã¾ãã
9patchãè¦æãªç»å
9patchã«ã¯è¦æãªç»åãããã¾ãã
ãã¨ãã°
ã¹ãã©ã¤ã*3
ã°ã©ãã¼ã·ã§ã³
ä¾ã«åºãã¾ãããã段差ãè¦ãã¦ãã¾ãã®ã§ãªã¹ã¹ã¡ã§ãã¾ããã
ãã®ä»é£ç¶ããæ*4
ä»ã«ããããããã¿ã¼ã³ã¯ããã¨æãã®ã§ãæ³åããªããä½ãã¾ãããã
AndroidSDKã®ä¸ã«å
¥ã£ã¦ãdraw9patchã¨ãããã¼ã«ã使ãã¨ãã©ããã風ã«è¡¨ç¤ºããããè¦ãªãã9patchã®ãã¼ã¯ãä»ããäºãã§ãã¾ãã
æ
£ããªããã¡ã¯ããã使ãã®ãæã§ãããã*5
ããã«9patchãç解ãã
èªãã ãã ã¨å®å
¨ã«ç解ã¯ã§ãã¾ããã
ãã以ä¸ã¯å®éã«ä½ã£ã¦ã端æ«ã«è¡¨ç¤ºããã¦ã¿ã¦ãæåãèªåã§ç¢ºããã¦ã¿ãã¨ããã¨æãã¾ãã
ãã®ä»9patchè¨äº
Draw 9-patch | Android Developers http://developer.android.com/guide/developing/tools/draw9patch.html å ¬å¼ã®9patch解説
Draw 9-patch - ã½ããã¦ã§ã¢æè¡ããã¥ã¡ã³ããåæã«ç¿»è¨³ https://sites.google.com/a/techdoctranslator.com/jp/android/developing/tools/draw9patch å ¬å¼ã®9patch解説ã®æ¥æ¬èªç¿»è¨³
9-patch - 3156note https://sites.google.com/site/3156note/home/android/9-patch draw9patchã®ä½¿ãæ¹ã詳ãã解説
ãã¥ã¼ããªã¢ã«:9patchã§ç»åãä½ã « Tech Booster http://techbooster.jpn.org/andriod/environment/3996/ draw9patchã®ä½¿ãæ¹ã詳ãã解説
draw9patch 㧠NinePatch ãã¤ããæ¹æ³ - Hacking My Way ã itogã®hackæ¥è¨ http://d.hatena.ne.jp/itog/20100209/1265684439 draw9patchã®ä½¿ãæ¹ã詳ãã解説
ã¾ã¨ã
- åç´ã«æ¡å¤§ãããããªãæã¯9patchã使ãã
- ã³ãã¼ãããå ´æãæå®ããã«ã¯ä¸ã¨å·¦ã«9patchã®ãã¼ã¯ãã¤ããã
- ä¸ã«ä½ãã³ã³ãã³ããå ¥ããæã¯ä¸ã¨å³ã«9patchã®ãã¼ã¯ãã¤ããã
- ã©ããªç»åã«ãªããæ³åããªããä½ãã
*1:xmlã§æå®ãããã¨ã«ããããã¿ã³ã¨ã¢ã¤ã³ã³ï¼ãã¼ããæï¼ãåé¢ãããã¨ãã§ãã¾ããåé¢ã§ããæ¹ããã¶ã¤ããããããã°ã©ãã¼ããã幸ããªã®ã§ããã¡ãã使ã£ãæ¹ãããã§ãã
*2:xmlã§æå®ãããã¨ã«ããããã¿ã³ã¨ã¢ã¤ã³ã³ï¼ãã¼ããæï¼ãåé¢ãããã¨ãã§ãã¾ããåé¢ã§ããæ¹ããã¶ã¤ããããããã°ã©ãã¼ããã幸ããªã®ã§ããã¡ãã使ã£ãæ¹ãããã§ãã
*3:9patchã§ã¯ãªããããã使ãã¨è§£æ±ºã§ããããããã¾ãã http://developer.android.com/guide/topics/resources/drawable-resource.html#Bitmap
*4:9patchã§ã¯ãªããããã使ãã¨è§£æ±ºã§ããããããã¾ãã http://developer.android.com/guide/topics/resources/drawable-resource.html#Bitmap
*5:å人çã«ã¯ããã使ãã¥ããã®ã§Fireworksã§å ¨é¨æãã¡ãã£ã¦ã¾ã