Nine patch image not working on my device?

前端 未结 4 1046
一生所求
一生所求 2020-12-06 23:41

This is the first time i use nine-patch image on my android app. It so stupit. When I preview on eclipse layout editor, it work. But when I build the application on real dev

4条回答
  •  一个人的身影
    2020-12-07 00:17

    I tested it more deeply, and it seems that there are inconsistencies between the draw9patch tool, Graphical editor in Eclipse and the device. Nine-patches, that seem to work in the first two, do not work on the device - they silently fall back to BitmapDrawable, without reporting an error. Reproduces on my 2.3.5 device, as well as in 4.1 emulator. See this android bug: http://code.google.com/p/android/issues/detail?id=38941

    Workaround is to draw single row of pixels, not just dots.

    TIP: your image should be as small as possible. If you put two dots to the left or top region, it means, that you have two stretched areas and the area between them is kept unstretched. You can cut out the area from the first dot (excluded) to the second dot (included) and have only one dot, with a smaller image and the same result.

提交回复
热议问题