2014-01-22 4 views
1

ImageView를 장치 화면의 가장자리에 맞게 ListView 행에 맞추고 싶습니다.안드로이드 - ListView에 ImageView 맞추기

이 내 현재 레이아웃입니다 다음 custom_row.xml에서

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

    <ListView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:smoothScrollbar="true" 
     android:id="@android:id/list" /> 
</RelativeLayout> 

: 나 이미지를로드 피카소 라이브러리를 사용하고

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

    <ImageView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/img_item" 
     android:adjustViewBounds="true"/> 

</RelativeLayout> 

. Picasa의 로더 옵션을 사용하여 .centerCrop, .centerInside 및 .fit를 사용하여 시도했습니다. 불운.

피카소 설정 :

Picasso.with(context) // 
     .load(iim.getResized()) // 
     .placeholder(R.drawable.placeholder) // 
     .error(R.drawable.error) 
     .fit().centerInside() 
     .into(vh.item_image); 

사람은 어떻게이 문제를 해결하기 위해 알아? 지금은 XML에

android:scaleType="centerCrop" 

+1

ScaleType = "centerCrop"을 Picasso 대신 XML에 넣으려고 했습니까? 어쩌면 이것이 문제를 해결할 수도 있습니다. –

답변

2

함께보십시오. layout_height를 설정해야합니다. 너비는 괜찮아.

0

귀하의 이미지 뷰 높이를 0dp입니다 :