Android nine patch - allow only a specific area of a background drawable to stretch

后端 未结 4 1593
傲寒
傲寒 2021-02-06 15:11

How does one go about creating a View that has boundaries with triangular perforations ?

I\'ve been using background drawables to achieve this so

4条回答
  •  名媛妹妹
    2021-02-06 15:49

    Instead of using a normal image, you can generate a nine-patch png.

    Use Simple Nine-patch Generator for this.

    The trick is the black line on the left side. That tells Android that the png is vertically expandable along this area.

    Please see this example:

    Save it as a nine-patch, in the format imagename.9.png

提交回复
热议问题