xml - Android layout: Quadratic views -


In an Android application I must add a view to my relaylayout which follows the following rules: < Ol>

  • The view must be square, i.e. the height and width of the scene must match.
  • The view must fill the entire WIDTH.

    It should look like this (the class should be standing):

      + ------------- + | Activity | | | | + ----------- + | || || || Square || || || || || || | + ----------- + | | | | | Finally - I should have an imageview that displays a quadratic image. Currently I did this by setting both width and height of the filvas and dragging the image right in the image (type scale = inside the center).  

    But: Now I want to see an additional scene in the alignment with the top line of the square scene, and this is where my viewpoint fails if I now see the width of the scene and its height at WRAP_CONTENT If set, the image will no longer fit in full width.

    Do you have a solution to this problem? If possible, it can be done simply by typing XML, it will be primary

    Thank you in advance!

    See the top answer on this question.



  • Comments