Reputation: 1496
I have an image that seems to change its size depending on the parents height, well the parent/parents height. Point is I do not want the image to change size. Is there some way to stop it from thinking for itself?
<ImageView
android:id="@+id/ivSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:src="@drawable/img_save"
android:layout_gravity="left"
android:contentDescription="@string/ivSave" />
Upvotes: 1
Views: 238
Reputation: 888
wrap_content
means that the view will resize automatically. To set a fixed size use:
android:layout_width="100dp"
and android:layout_height="100dp"
Use 'dp' instead of 'px', because these are device-independent.
Upvotes: 2
Reputation: 554
try
android:scaleType="centerInside"
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/img_save"
android:scaleType="centerInside">
</ImageView>
click here for more image scale type
Upvotes: 1