0

I have one question. I want to set one image to image button. I have one button image of size 90 x 48. I want to set this image on Image button.

Problems:

  1. I need to set image on background parameter or src parameter?
  2. If i set image on background parameter its not showing its actual size(smaller than actual size) if i have set the Layout width = wrap content and Layout Height= wrap content. If i give Layout width = 98dip and Layout Height= 48dip then its showing the same size. Is it a coorect way?

thanks

asked May 10, 2011 at 7:08

2 Answers 2

1
  1. set image as background Parameter sometimes src makes problem
  2. if you are set width and height as wrap_content then android will check the screen size and try to adjust to your screen if screen size is big then android displays your image as its actual height and width and if screen size is less then it will compress your image

so best way is to set height and width is as wrap_content if you have to use portrait and landscape mode both

answered May 10, 2011 at 7:21
Sign up to request clarification or add additional context in comments.

Comments

1
  1. Yes.
  2. If you use Layout width = wrap content and Layout Height= wrap content, image will be as actual size. Maybe just the density of your monitor is less than the density of your phone? Remember dip != pixels.
answered May 10, 2011 at 7:13

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.