image - Android - ImageButton positioning to bitmap -


Okay, though I use this site a lot, it really is my first question.

Although I have many years of experience in programming using Visual Studio, I have recently been stuck in image positioning (using android studio) android.

I have an image in an imageview that automatically scales for the screen (as you would expect) for the orientation of the screen and the super imaging applied to it.

Currently, I am using Auto Position in ImageView for ImageButtons, but to the right of the image (scaled) in the upper right corner of the image, Or the situation does not matter.

I can get the size of the image (default), but I need to recover, size scale and x: y coordinate and then accordingly adjust the setTop () and setRight () of ImageButton Please.

I have read the burden of examples here but I feel that none of them want to do what I want. Is there a simple way to get the size / status of the display / scale image (where the actual image pixels are displayed), or something that I have to do manually by creating my own function?

Thanks in advance.

Right Landscape:

Enter image details here

wrong landscape:

enter image details here

Correct Portrait:

Enter image details here

Incorrect portrait:

Enter image details here

I have not understood the problem ... but I try to create and answer for it Received.

When you use imageView you can set this property

  scaleType = "fitXY" adjust the bound = "true"   

This will see your image in the center, if necessary, resize the XY but please remember that you use src = "" and using Setgound in the image view do not require.

OK, with this, we will go forward. RelativeLayout

For example create a frame layout for a parent, create relative layout (nesting is not necessary, but now we Will use it). & lt; Relative layout Android: layout_width = "wrap-content" Android: layout_height = "wrap_content" & gt; & Lt; ImageButton Android: Layout_LinePantTop = "True" Android: Layout_NamePrinTrite = "True" Android: src = "@Drawable / ICDED" /> & Lt; ImageView android: layout_width = "match_parent" Android: layout_width = "wrap_content" Android: Adjusted ViewBounds = "true" Android: scaleType = "fitXY" Android: src = "@drawable / icedad" /> & Lt; / RelativeLayout & gt;

I do not test it but I give it to the main idea.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -