tags:

views:

53

answers:

1

Hi,

I have an image which is 80px X 50 px, and I need to place that in one of the child of a FrameLayout, how can I specific the layout_width and layout_height of a Framelayout which fits an image without scaling it?

I know there is a layout_height="wrap_content" layout_wight="wrap_content" for FrameLayout, but I can't use it, since that FrameLayout has other children. So I would like to hard code the FrameLayout width/height to match the dimension of the image?

Should I use layout_width="80px" or layout_width="80dip"?

Thank you.

A: 

You can use layout_width="80px" + layout_height="80px" + scaleType="fitXY" to specify the ImageView in the size you want.

dip depends on the screen densities, which says, 1dp != 1px.

Johnny