imageview - Does android:scaleType="fitCenter" only work with fix Layout_width and Layout_height attributes? -



imageview - Does android:scaleType="fitCenter" only work with fix Layout_width and Layout_height attributes? -

i utilize layout_width="fill_parent" , layout_height="wrap content". if image bigger imageview, downscaled perfectly.

however, never got working upscale smaller images. tried combination of scaletype , "adjustviewbounds": stays in own size in middle of image view. here code...

<linearlayout android:id="@+id/linearlayout02" android:layout_height="wrap_content" android:background="@drawable/content_bg" android:orientation="vertical" android:padding="5dp" android:layout_width="fill_parent" android:layout_marginleft="1px"> <imageview android:layout_height="wrap_content" android:src="@drawable/test" android:id="@+id/imageviewtest" android:layout_width="fill_parent" android:adjustviewbounds="true" android:scaletype="center"></imageview> </linearlayout>

i found way create work.

this works in 2.1(avd) & 4.1.2(device)

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:id="@+id/imageview1" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="fitcenter" /> </linearlayout>

android imageview android-layout android-image

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -