Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8204283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:51:04+00:00 2026-06-07T07:51:04+00:00

I have a layout that has some horizontal scroll on top, some text box

  • 0

I have a layout that has some horizontal scroll on top, some text box on the bottom and whatever space is left in the middle I fill it with an ImageView. In that ImageView I load a bitmap. Let’s call this ImageView the bottom one.

Now, on top of that ImageView I load dynamically another ImageView that the user can move about by dragging it. The second ImageView (top one) has a small icon in it that will be overlayed on top of my bitmap and saved. Think of it as a logo/watermark.

Both ImageViews are in a RelativeLayout, so I can move the top layout around.

Now the problem I have is that I can not get the size of the bitmap that is loaded in the bottom ImageView.

I have tried the following:

DisplayMetrics om = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(om);
tv.setText("W:" + b.getScaledWidth(om) + " H:" + b.getScaledHeight(om));

but it won’t work, b.getScaledWidth(om) returns the actual width of my bitmap and not the one on screen, which should be (in case of a landscape image) 480px, the size of the screen of the phone I am testing on.

ADDITIONAL INFO: Why I need this is because the image I show in bottom ImageView is not of the same proportions as the ImageView. So I can get the size of the ImageView but this ImageView is larger then the image itself. As I need to keep the top ImageView inside the boundaries of image that is shown in bottom ImageView I need to know the size of the image in the bottom ImageView and not the size of the bottom View itself.

Any ideas what am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:51:06+00:00Added an answer on June 7, 2026 at 7:51 am

    I did not find a way so I did it “manually”.

    I extended ImageView class with my MyImageView class and in the onMeasure override I have calculated scale factor and accordingly created a Rect representing boundaries in coordinates according to my RelativeLayout, inside of which is MyImageView.

    I went this way because I found a post here that referred to creating own ImageView class, can’t find a link anymore.

    Anyway, after that I check top/left positioning of top ImageView and set the maximum location while moving it around in the onTouch method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a layout that is three linear layouts. The top has some icons
I have a two column site layout that has the content of the left
Have a liquid layout that has fixed width for left side and elastic right
Hy, I have a layout in the views/layout that has 2 cols and then
I have a Linear Layout that has a Button and a TextView on it.
I have been able to design my layout so that it has 2 columns
I have an ExtJS Viewport with a container that has the border layout and
I have this layout that works correctly, a relative layout with a text view
I have an XML layout that defines a TextView box 50px x 320px who
I have some code that creates a popup and assign it an XML layout

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.