A possible solution:
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="@drawable/lock"
android:scaleType="centerInside"/>
There are othe scale types, test them until it belongs to Your needs:
http://developer.android.com/reference/android/widget/ImageView.ScaleType.html