Is there any Android developer documentation that says when drawable resources can be 9-patch? To put it another way, is there a document that says something along the lines of "the following items use 9-patch data, if available"?
From poking around and experience, I've learned that 9-patch graphics should be used for
- application launcher icons
- icons used in the "Add to Home screen" selection list for App Widgets, Wallpapers, and Folders
- desktop wallpapers and when otherwise using BitMaps, e.g. on canvases
- button graphics
- view backgrounds
I've been surprised to see that 9-patch data is ignored when drawables are used for menu icons and tab icons.
9-patches is best used when you have an image that needs a fluid width and/or height.
Example: In my app I had two custom buttons that stretched across the bottom of the view. Because screen sizes can differ, I used 9-patches to allow the buttons to stretch correctly.
来源:https://stackoverflow.com/questions/5995880/when-to-use-9-patch