2016-08-01 41 views
0

我有一個ImageView和EditText的自定義列表視圖,我的問題是,與不同的圖像ImageView的大小是不同的,如照片。 我如何確保所有圖像具有相同的尺寸?ListView中不同的ImageView大小查看

Image of listView

這是我的XML代碼:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="horizontal" 
android:weightSum="1"> 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="150px" 
    android:layout_height="150px" 
    android:adjustViewBounds="true" 
    android:layout_weight="0.1" 
    android:scaleType="fitXY" 
    android:layout_marginBottom="1dp"/> 
+0

嘗試android:scaleType =「fitCenter」scaleType –

+0

Simone - 如果你已經解決了你自己的問題,請在下面添加回答。 –

回答

0

處理不同的縱橫比的圖像你最好的辦法是選擇在佈局和中心作物方面比你的形象,使他們填寫可用空間。

<ImageView 
    android:layout_width="160dp" 
    android:layout_height="90dp" 
    android:scaleType="centerCrop" /> 
0

好爲更好大小,創建用於容納ImageView的EDITTEXT每行線性佈局。 您已將ScaleType設置爲fitXY,這很好。現在使用dpfill_parentImageview大小。

0

(發表於OP)

我解決了這個問題 - 我只是刪除了這個android:layout_weight="0.1"