how does a 9patch png work in android apps

In a 9patch png, there are black edges in its four sides, but there is usually difference between the left to right, and the up to down side. Why? How does this difference impact?

  • Unable to INSERT in SQLite, Error code:19
  • How to programmatically get the list of registered users in Firebase
  • How to get all the events from calendar?
  • how to clone an object in android?
  • Retrofit 2.0 OnFailure - Raw Response
  • How to create a link for all mobile devices that opens google maps with a route starting at the current location, destinating a given place?
  • Related posts:

    Embedded youtube video on touch device showing right click context menu automatically
    What do I need for programming for Tegra GPU
    Wait for user permission
    Set Background color programmatically
    Search widget call OnNewIntent twice
    android dexclassloader get list of all classes
  • TelephonyManager.getLine1Number() failing?
  • How do I get my .so libraries copied to the Android device?
  • Android - How do I specify a location when calling the calendar with an intent?
  • Youtube Ads Before Targeted Video
  • How to prevent WebView auto refresh when screen rotation
  • Setting ID for Spinner items
  • 3 Solutions collect form web for “how does a 9patch png work in android apps”

    One of simplest ans is this pic

    draw the black line according to your requirement using nine patch tools.

    You can find more information about how nine patch works here

    The left and top are for scaling, and the right and bottom are for content. So the black lines on left and top will scale to fit, and the content for a button will be “inside” the black lines on the right and bottom.

    Here you can find a very good explanation, with images to show you that the left and top part of the black border indicate a stretchable section, while the right and bottom lines define the drawable area, where you can put your content.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.