New extension release! Nine Patch Support! - By ColinTree


#1

In the past, when we are using Appinventor or Thunkable, we may meet a problem, that the picture will look ugly after zooming, because the size is no more match what we want

Actually in Android this may happen, but the engineers will not allow this happen for sure.
So that is why nine-patch was created.

One of Android’s most well-known points to consider in application development is the requirement to support a variety of different screen sizes and orientations in an application. The SDK is full of documentation and tools on how to help the developer best accomplish this goal.

The 9-Patch is a PNG image with some coding added that allows the Android system to determine how the image can be stretched and contorted to meet the specific layout constraints during use (like fill_parent and wrap_content). It does this by taking a predefined PNG image, and allowing the user to define a 1-pixel border around the image in locations where stretching can occur.

Now with NinePatchChunk liburary (the author Anatolii published on Github) and the extension by ColinTree, NinePatch is much more easier to be used on Appinventor and Thunkable.

Methods

  • SetCompiledNinePatch
  • SetRawNinePatch
  • ** Parameters: **
    • component
      e.g.

      It is usually the last block of a component.
    • path
      e.g.
      sample.9.png - the asset “sample.9.png” that was uploaded

Sample

Now here is a compiled picture "menu_dropdown_panel_styled.9.png"
If it is set onto the Button1 by ColinTreeNinepatch, it works well with 9-patch rules
But if the it go through Button1.Image, it still looks horrible.


DOWNLOAD LINK & MORE YOU WANT TO KNOW IS HERE

donate me if you find this is helpful: https://www.paypal.me/ColinTree
this may give me power to continue working!

Thanks!


The longest list of things to add in Thunkable
Continuum Browser (Soon on Google Play Store)
#3

Hi Colin Tree! First of all, thank you for your contribution. I’ve have just test your extension( change the picture of your sample aia) . I built an apk, then installed, but it can not run(can not open). this is my pic. So where i was wrong? Thanks!


#4

Works just fine.
Did you compile your 9 patch image, if not use the second block.

this works on android 4.3, 5.0, 7.0 ColinTreeNinePatch_en.apk (2.3 MB)

Btw @ColinTree, good work with this extension.


#5

hello @Manu !
your picture here is a raw nine-patch picture, please use SetRawNinePatch to setup the image


(screenshot ref: @Boban_Stojmenovic)
hope that helps you~


#6

Thank you :joy: