Android stretch image,

Source: Internet
Author: User

Android stretch image,

Androidstretch images are in 9.png format. This image can be used to specify the part of the image to be stretched. The part of the displayed content can also be effectively displayed by the artist.

 

Original background imageProduction example 2.16.9.png

Open the Android sdk> tools> draw9patch.batand drag the image to start production.

 

 

Click around to add black spots. Drag black spots to line. Black lines and black spots around the image have different meanings.

The black line or point above indicates that the area that can be stretched vertically is generally a point.

Black lines or dots on the left represent a point in the area that can be horizontally stretched.

The following area indicates that the vertical content is generally a black line.

The area on the right that indicates horizontal content is generally a black line.

 

 1 <RelativeLayout xmlns: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     <TextView android:text="@string/hello_world"10         android:layout_width="wrap_content"11         android:layout_height="wrap_content"12         android:gravity="center_vertical"13         android:background="@drawable/bg"/>14 15 </RelativeLayout>

 

OK

Run the program

Note:Do not overlap the black spots on the left with the gaps on the right. Otherwise, the right side will be stretched.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.