android - How to make a zig-zag layout? -
i want create zig-zag layout same following attached image:
i tried lot creating diagonal lines , arranging them icon couldn't make same.
i implemented diagonal lines of accepted answer following questions:
however i'm stuck arrange lines icons same in image.
i created custom zigzaglayout.java file cater requirement. have update package name in 1st line. extends relativelayout
, can use in layout-xmls other viewgroup
class. once have instantiated layout, add child-views done relativelayout
via addview(view child)
.
example code snippet dynamically created view:
zigzaglayout zigzaglayout = (zigzaglayout) findviewbyid(r.id.layout_zigzag); button btn = new button(this); btn.settext("test button"); btn.setlayoutparams(new relativelayout.layoutparams(relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content)); zigzaglayout.addview(btn);
i've added few interfaces zigzaglayout
easy interaction ability set connector-line stroke width, visibility, color, margins, etc.
try out , let me know if suffices requirement. cheers.
Comments
Post a Comment