This topic describes how to use 9-patch images for the splash screen of your Android applications. Android may stretch the image when displaying the splash screen; use 9-patch images to define how these images should be stretched. A 9-patch image is a stretchable bitmap image with. You can create a 9-patch image to configure how the image can be stretched when it needs to be resized.
To indicate the stretchable area or the padding box part of the image, in the corresponding one-pixel wide guide, paint in solid black the pixels that define the stretchable or drawable areas, the rest of the pixels define the non-stretchable or non-drawable area and should be fully transparent or white.
You may check Android 9-patch documentation for further information 9-patch images. Configure your build. Optimize your build speed. Debug your app. Test your app. Profile your app. Android Studio profilers. Profile CPU activity. Benchmark your app.
Measure performance. Publish your app. Command line tools. I am drawn to the geometric designs and rich colors of early pieced quilts and often add my 21 st century spin. Some works are quiet and elegant, others boldly abstract and surprisingly contemporary. All share a connection with the most dynamic and fascinating century in American quilting. The background is then set to the Nine Patch file generated as above. To indicate focus for keyboard support combine the image with another one in a selector file similar to the selector file in the tutorial ImageButton Graphics with Inkscape Example.
Here an orange version of the background rectangle is drawn to support focus indication. The bitmap is changed to a Nine Patch file as before and saved to turqfocus. The selector XML file here as selector. In the following example EditTexts with the nine patch background create above are shown with different text sizes.
Nine Patch files are not restricted to simple View backgrounds. This Nine Patch file is used to frame a photograph. The left and top scaling indicators are spaced where detail that must not be scaled is located. Here it is the small hearts that must not be scaled otherwise they will be distorted.
Download the example project code in ninepatch. See the instructions in the zip file. The zip file can also be accessed via the Android Example Projects page.
A version of this article was produced for the Android Cookbook. The pink heart frame used in this article was derived from an image from the Open Clip Art Library.
0コメント