views:

44

answers:

1

I want to diplay an image so that it takes up a minmum width of the screen and should scale in its aspect ratio (the image width might be smaller or larger than the minimun width) I also want to have a fixed size border around this image. This is my xml section for it:

<ImageView
        android:id="@+id/detailed_view_boxArt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minWidth="150dp"
        android:layout_alignParentLeft="true"
        android:layout_below="@id/detailed_view_heading"
        android:padding="10dp"
        android:layout_marginLeft="5dp"
        android:scaleType="centerInside"

        android:background="#000"/> 

This however does not produce what I want...the problem is that it does not scale the image horizontally far enough (ie. the 10px padding that I have seems a lot more on the right and left)

How would I produce the result that I want?

A: 

to set minimum width and heidht use the attributes android:minHeight="100dip" and android:minWidth="200dip".

to set the Border check my post.

Praveen Chandrasekaran
Thanks for the info...however the way I have created the border works just aswell as your method. The problem is I want to ONLY set a minWidth and have the image stretch both horizontally and vertically...
Kman
@Kman: Can not get you properly. my guess is you to set the value for your `android:layout_width="100dip"` not `wrap_content`.
Praveen Chandrasekaran
no no my xml is exactly like the code I have in the question...Ok basically I want to make the image larger/smaller while keeping its aspect ratio so that it ends up with a minimum width of 150dp. So for example lets say I have an image of 50dp wide 100dp high I want it so that it shows the image as 150dp wide 300dp high. Is that clearer? Thanks
Kman
@Kman: Thats great idea. I have to research on it. when get answer. let you know.
Praveen Chandrasekaran