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?

  • Should I use JavaCV or OpenCV's java library on Android?
  • How do I use sharedPreferences outside of an Activity?
  • AsyncTask.executeOnExecutor() before API Level 11
  • What are consequences of having GCM SENDER ID being exposed?
  • Android WebView not loading URL
  • how to optimize renderspeed in android webview
  • Related posts:

    android TextView : Change Text Color on click
    Android QRCode Scanner Library
    Hide Day, Month, or Year from DatePicker in Android 5.0+ Lollipop
    Android page Curl animation
    Disable/Enable mobile data on Android L with root access
    Dismiss Ongoing Android Notification Via Action Button Without Opening App
  • Android Studio with gradle and Google Maps v2
  • stopService doesn't stop's my service… why?
  • Why is it impossible to use the Speech Recorder on the Android emulator?
  • Android Config File
  • Gradle cannot resolve dependencies in Android Studio
  • Android - Getting audio to play through earpiece
  • 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 http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch 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.