I have a widget that includes 2 image views. When I resize the widget, one of the image views remains the same size, but the other one changes. I want them both to remain the same size, but I don’t know what the difference between the images is. Both are defined with the same attributes in the layout (except for the src of course), and both are located in drawable-hdpi. How does Android determine whether to resize an image or not? Are there some special attributes it needs to have?
Thanks for any help.
Here’s the layout:
<LinearLayout android:layout_width="0dip" android:layout_height="fill_parent"
android:orientation="vertical" android:layout_gravity="right"
android:layout_weight="0.1">
<ImageView android:id="@+id/update_button" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/update_blue_small"
android:contentDescription="@string/update_content_description"/>
<!-- android:text="@string/update_button_label"/> -->
<ImageView android:id="@+id/configure_button" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/update_blue_small"
android:contentDescription="@string/config_content_description"/>
<!-- android:text="@string/configure_button_label"/> -->
</LinearLayout>
Try setting
android:scaleType="center"on each of the ImageViews.Check out the docs for ImageView.ScaleType for more details.
http://developer.android.com/reference/android/widget/ImageView.ScaleType.html