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:
- I need to set image on background parameter or src parameter?
- 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
vivek_Android
1,7075 gold badges26 silver badges43 bronze badges
2 Answers 2
- set image as background Parameter sometimes src makes problem
- 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
Dharmendra
34.2k23 gold badges89 silver badges133 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
- Yes.
- 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
Divers
9,5797 gold badges48 silver badges90 bronze badges
Comments
default