It seems that NinePatchDrawable objects do not allow you to access the basic bitmaps, but I suppose you could draw them on the canvas and then read the resulting bitmap from this. This will probably also solve your problem with two strengths.
You can then read the fill area using getPadding () and convert these positions to a range of 0..1 to use as texture coordinates.
Then, in OpenGL, you will draw a textured brick using a nine-quad grid, such as the "#" symbol. Your texture coordinates for the vertices will be fixed and match your addition with nine patches. The coordinates of your position will depend on the scaling of your block. You would keep your corner squares the same size and scale the square square as desired. (The rest of the squares will be scaled in one dimension, as required so that everything is connected).
Personally, I would be inclined to forget about nine Android patches and instead adopt a brickwork convention where (say) the average 50% of the width and height are stretched, and 25% are not around the perimeter. Depends on how much work you throw away nonetheless.
source share