我有一個imageview
,它的高度和寬度設置爲fill_parent
,其中linearlayout
具有相同的值集。所以我想這應該設置我的圖像適合屏幕。但它只適合80%(在橫向模式下保證金頂部和底部)。android:在imageview中將圖像拉伸爲適合屏幕
我已經嘗試沒有成功下面的代碼:
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
imgView.setMinimumWidth(width);
imgView.setMinimumHeight(height);
imgView.setMaxWidth(width);
imgView.setMaxHeight(height);
任何其他的想法?
雖然這是一個稍微不同的問題,你必須指定
android:layout_width="75dp"
和android:layout_height="75dp"
,[這個答案](http://stackoverflow.com/questions/2991110/android-how-to-stretch-an-image-to-the-screen-width-while-maintaining-aspect-rat/2999707#2999707)應該可以幫到你。 – fredley 2011-01-12 11:51:56