我用Layout_width="fill_parent
「和Layout_height="wrap content"
。如果圖像比ImageView的更大,這將是完全按比例縮小。是否android:scaleType =「fitCenter」僅適用於修補Layout_width和Layout_height屬性?
但是,我從來沒有得到它的工作,以高檔的小圖像。我試圖和ScaleType任意組合‘AdjustViewBounds’ :它總是停留在圖像取景當中自己的大小這裏是代碼...
<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>
嘗試使用CENTER_INSIDE或FIT_XY。 – bhups 2010-09-24 09:02:05
我嘗試了所有這些。他們都沒有爲我工作。 – OneWorld 2010-09-24 09:12:48
我發現讓它工作的唯一方法是將layout_hight和layout_width設置爲固定值,如150dp x 200dp – OneWorld 2010-11-05 21:39:03