Android, how to make ImageView with minWidth has a border?

I want to diplay the image so that it occupies the minimum width of the screen and needs to scale in its aspect ratio (the width of the image can be less or more than the width minimun). 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 give what I want ... the problem is that it does not scale the image horizontally far enough (i.e. 10px fill, which I think is much larger on the right and left)

How can I get the result I want?

+5
source share
2 answers

heidht android:minHeight="100dip" android:minWidth="200dip".

.

+4

( ):

<ImageView
    android:id="@+id/detailed_view_boxArt"
    *android:layout_width="match_parent"*
    *android:layout_height="wrap_content"*
    *android:adjustViewBounds="true"*
    *android:scaleType="centerCrop"*                   
    android:layout_alignParentLeft="true"
    android:layout_below="@id/detailed_view_heading"
    android:padding="10dp"
    android:layout_marginLeft="5dp"
    android:background="#000"/> 
+3

All Articles