Android: alternative to AbsoluteLayout (I really need absolute positioning)

I am trying to write a calendar application, and I plan to have a grid (week view), which is likely to be TableLayout, and right on top of this I will have to absolutely position the events in the grid.

But AbsoluteLayoutoutdated. What should i use instead?

Events can overlap, and I think it would be foolish to try not to use an absolute layout to achieve what I want.

Perhaps I should use RelativeLayoutthe left edge and top edge on each of the child nodes. It seems strange to do it this way and may not be as effective. Is this the best way or is there an alternative?

+3
source share
3 answers
  • CommonsWare suggested writing its own layout manager, and Christian pointed out that it sounds easier than it is.
  • Yahel proposed SurfaceView / OpenGl and drew whatever he wanted.

I found out that you can recreate absolute positioning by adding your child views to RelativeLayoutand set the parameter to RelativeLayout.LayoutParamsonly the default values ​​except width, height, marginTop and marginLeft. The top and left margins will be similar to the top and left margins AbsoluteLayout. Negative fields are also supported.

Make sure that you consider the screen density, width and orientation, as well as all other absolute positioning restrictions that were used for AbsoluteLayout

, . ( )

+1

AbsoluteLayout . ?

, .

+1

:

  • 15 ( 30) , . , 15 .

, // :

  • SurfaceView/OpenGl , .

1 , , . , 3 , , .

2: . , , openGL.

0

Source: https://habr.com/ru/post/1786699/


All Articles