2017-02-22 5 views
0

나는 recyclerview이고 그 안에는 NetworkImageView이고 일부 텍스트보기가 있습니다.이미지 크기에 따라 NetworkImageView와 TextView 사이의 공간

NetworkImageView의 이미지에 따라 이미지가 작 으면 공간이 추가되지 않지만 이미지가 크면 이미지와 textview 사이에 큰 공백이 추가됩니다.

space no space 그래서 첫 번째 사진에서 그것은 이미지와 이름/출판사 사이에 큰 공간이 마련되어 있습니다.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <android.support.v7.widget.CardView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <LinearLayout 
      android:padding="@dimen/activity_horizontal_margin" 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" > 

      <com.android.volley.toolbox.NetworkImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:padding="0dp" 
       android:id="@+id/imageViewHero" /> 

      <TableLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <TableRow> 
        <TextView 
         android:text="Name" 
         android:paddingRight="10dp" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         /> 

        <TextView 
         android:id="@+id/textViewName" 
         android:textStyle="bold" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         /> 

       </TableRow> 

       <TableRow> 
        <TextView 
         android:text="Publisher" 
         android:paddingRight="10dp" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         /> 

        <TextView 
         android:id="@+id/textViewPublisher" 
         android:textStyle="bold" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         /> 

       </TableRow> 

      </TableLayout> 
     </LinearLayout> 
    </android.support.v7.widget.CardView> 

</RelativeLayout> 

어떻게이 공간을 제거하거나 (대신 임의 일의) 내 자신을 추가 할 수 있습니까?

답변

1

레이아웃을 디버깅하면 NetworkImageView가 실제로 빈 공간을 차지하고 있지만 이미지 비가 전체 공간을 채우지 못하는 것을 알 수 있습니다. NetworkImageView에

을 추가하십시오.

+0

당신은 놀라워요, 감사합니다! –

관련 문제