There is a RelativeLayout with several TextVeiw. It is necessary to make it so that the figure (a rectangle to begin with) was visible under all these views. Access to the shape is needed as the software changes color, shape size, thickness of the frame. As I understand it at the same time can not be used:

setContentView(R.layout.activity_main); setContentView(new DrawView(this)); 

in this case, the last element completely removes the first one.

    1 answer 1

    Assign an id for RelativeLayout in xml and initialize in code. After that, through the addView() method of the initialized view - add your rectangle, in particular addView(0, view) - using the index 0 put the added view into the background.

    • Thanks for the answer. But the problem is that I don’t know how to add a rectangle without a canvas or xml. - lmihael
    • rlTableBody.addView (0, rect); - lmihael
    • rlTableBody.addView (0, rect); does not work as addVeiw cannot be applied to android.graphics.Rect - lmihael