Android - How to draw a letter at a specific point?

前端 未结 4 1587
梦毁少年i
梦毁少年i 2021-01-16 11:14

I want to fill the screen with a 100 different letters in random positions. On the iPhone I just created a bunch of UILabels set their x and y positions and then used animat

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-16 11:44

    In android positioning child views is the responsibility of the layout class.

    You need to create a custom.layout and overide the onLayout method. In this method you can iterate through all the child views calling View.layout(left,top,right,bottom) on each child.

    i found this example code whilst trawling the net : https://gist.github.com/882650

    You should also check out view.setTranslationX (and Y) which might be exactly what you need

提交回复
热议问题