0

I am trying to make 2 pictures to be in a random position, each one in other half on the screen. For that, I am using setX() and setY() functions. those picture (Imageview) are childs of one relative layout. But in a different screens the width is different, so is the height. I know that in other android development languages, you can scale the screen width and height to be from 1 to 0 (this way, the center is setX(0.5))

Is there something like this in Android Studio?

Liroshka
  • 69
  • 9

1 Answers1

0

You can use ConstraintLayout, where it can be solved easily. Just set the 2 images constraints to the parent and left image end constraint to the right image start. Here is the documentation: https://developer.android.com/training/constraint-layout/index.html

TokajiP
  • 36
  • 3