I have a view of an image whose background is an xml shape, that is, a rectangle shape suitable for drawing. My application orientation is tied to the landscape view.
Image is in relative layout.
I am trying to move it to the right of the screen by setting the appropriate layout_marginRight value, but this will not work. ImageView is always in the starting position.
I also tried the following other options, but no one helped.
Other options I tried:
- Creating new relative placement parameters and setting the correct field
- Creating new field layout options and setting a position
- Gasket Run Option
- Setting the image to the desired position relative to another image ...
- Using display metrics to get the width of the screen and, accordingly, setting the field ....
Iβve been stuck for a week setting the position of this image ...
I thought the best approach is to set this image between two images, since I cannot move it by setting a field, but this also does not work.
Here is the current xml of my image in main.xml: -
<ImageView android:id="@+id/rect1" android:background="@drawable/rect" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentBottom="true" android:layout_marginRight="70dp" android:scaleType="fitCenter"/>
Ruchira
source share