Android stretched pictures with a 9.png format picture, this picture can specify the part of the image stretching, that part of the display, the artist gives a small picture can also have a good display effect.
The original background picture can see the original background image is very small, even in the longer text, the background image of the fillet will not stretch
Making ###.9.png
Open Android Sdk>tools>draw9patch.bat, drag the picture and start making ###.9.png
Click four weeks to add black dots and drag black dots to line up. The black and black dots around the picture have different meanings.
The upper black line or dot indicates a vertical stretch of the area generally a point can be
The left black line or dot indicates a horizontal stretch of the area generally a point can be
The following indicates that areas of vertical fill are usually a black line
On the right, the area where the content is horizontally filled is usually a black line.
1 <Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"2 Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"3 Android:layout_height= "Match_parent"Android:paddingleft= "@dimen/activity_horizontal_margin"4 Android:paddingright= "@dimen/activity_horizontal_margin"5 Android:paddingtop= "@dimen/activity_vertical_margin"6 Android:background= "@android: Color/darker_gray"7 Android:paddingbottom= "@dimen/activity_vertical_margin"Tools:context=". Mainactivity ">8 9 <TextViewAndroid:text= "@string/hello_world"Ten Android:layout_width= "Wrap_content" One Android:layout_height= "Wrap_content" A android:gravity= "Center_vertical" - Android:background= "@drawable/bg"/> - the </Relativelayout>
Ok
Run the program
Note: the black dot on the left is not coincident with the gap on the right, otherwise the right side will be stretched.
Android stretched Pictures