| 主題開發者進修區 [APKTOOL] |
| 文章說明 簡單說明draw9patch的應用及製作 |
| 參考來源網址 Android Developers |
| 注意事項 標註縮放範圍的邊框必須為純紅色或純黑色,否則編譯會發生問題 | |||
| #000000 | 0 0 0 | 純黑色 | |
| #FF0000 | 255 0 0 | 純紅色 | |
| 快速修改教學 |
1 |
| 從電腦上啟動「Draw 9-patch」修改工具: 「SDKsdk/tools/draw9patch.bat」 |
2 |
| 拖曳欲修改的PNG圖檔到「Draw 9-patch視窗」,現在使用介面已經開啟。 左半部是繪圖區塊,在這裡你可以編輯可延展的區段以及核心區塊。 右半部是預覽區塊, 在這裡你可以預覽圖片實際的延展行為 |
|
|
3 |
| 點擊1個像素寬的邊框繪製補丁線定義圖片拉伸區塊以及(可選擇的)核心區塊。 右鍵(在Mac上按住Shift鍵並點擊)以去除先前繪製的線段。 |
4 |
| 修改進入尾聲,選擇 File > Save 9-patch... 你的圖檔將會已「.9.png」作為檔案名稱儲存。 |
| 提醒 為了確保NinePatch圖像能正確地縮放,務必校驗圖片的可延展區域大小至少有2x2像素。 順道一提,圖像可能在縮放後出現消失情形。 此外,在設定延伸區塊前至少要在圖像的每一邊保留一像素的安全區塊以避免邊界的顏色改變導致延展時發生問題。 |
| 延伸閱讀 Jollen 的 Android 教學,#30: R.drawable 應用-製作NinePatch圖檔 |
| 包含其中的控制選項 |
| Zoom |
| Adjust the zoom level of the graphic in the drawing area. |
| Patch scale |
| Adjust the scale of the images in the preview area. |
| Show lock |
| Visualize the non-drawable area of the graphic on mouse-over. |
| Show patches |
| Preview the stretchable patches in the drawing area (pink is a stretchable patch). |
| Show content |
| Highlight the content area in the preview images (purple is the area in which content is allowed). |
| Show bad patches |
|
| 歡迎光臨 Android 台灣中文網 (https://apk.tw/) | Powered by Discuz! X3.1 |