Reputation: 539
I have the following widget :
The Image is ok if the widget size w=h , but its streching if different.
How to keep it proportional ? And resize should even work.
My XML :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Widget"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<ImageView
android:id="@+id/buttonwidget"
android:src="@drawable/normalwidget"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" >
</ImageView>
I would prefer a XML solution and not Drawable code if possible.
Upvotes: 0
Views: 775
Reputation: 539
Thanks to @Samuil Yanovski he did fix it..
i changed my XML to :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/Widget"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >
<ImageView
android:id="@+id/buttonwidget"
android:src="@drawable/normalwidget"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter">
</ImageView>
</FrameLayout>
And all is fine how i like it :)
Upvotes: 2