2012-10-07 11 views
0

나는 목록보기를 가지고 있습니다. 각 행에 다음 필드를 표시하고 싶습니다.안드로이드의 ListView에서보기의 크기를 늘리십시오.

1. An Image 
2. An TextView For Book Name 
3. An TextView For Author Name 
4. An TextView For File Type 

모든 것이 성공적으로 수행되었습니다. 그러나 목록보기에서 각 행의 크기는 이미지에서 설명한대로이 모든 기능을 표시하기에 충분하지 않습니다.

enter image description here

이 작성하는 코드 :

다음과
if(row_view == null) 
     { 
      LayoutInflater inflater = context.getLayoutInflater(); 
      row_view = inflater.inflate(R.layout.row_layout, null,true) ; 
      holder = new ViewHolder(); 
      holder.textView_for_BookName = (TextView) row_view.findViewById(R.id.book_text_view_book_tab); 
      holder.textView_For_fileType = (TextView) row_view.findViewById(R.id.type_for_book_tab); 
      holder.textView_Forauthor = (TextView) row_view.findViewById(R.id.author_text_view_book_tab); 
      holder.imageview = (ImageView) row_view.findViewById(R.id.image_sd_list_view); 
      row_view.setTag(holder); 
     } 

rowLayout.xml의 코드대로 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#FFFFFF" 
    android:orientation="horizontal"> 

    <ImageView 
    android:src="@drawable/icon" 
    android:layout_width="wrap_content" 
    android:id="@+id/image_sd_list_view" 
    android:layout_height="wrap_content"> 
    </ImageView> 

    <LinearLayout 
    android:id="@+id/linearLayout1" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

     <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingTop="5dip" 
     android:paddingBottom="5dip" 
     android:textColor="#000000" 
     android:textSize="20dip" 
     android:paddingLeft="10dip" 
     android:text="Book Name" 
     android:id="@+id/book_text_view_book_tab"> 
     </TextView> 

     <TextView 
     android:id="@+id/author_text_view_book_tab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Author Name" 
     android:textColor="#000000" 
     android:textSize="13dip" 
     android:layout_marginLeft="15dip"> 
     </TextView> 

     <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="File Type :" 
     android:textColor="#000000" 
     android:layout_marginLeft="15dip" 
     android:textSize="10dip" 
     android:id="@+id/type_for_book_tab"> 
     </TextView> 

    </LinearLayout> 

</LinearLayout> 

내가 위의 필드를 표시 할을 (BOOK_NAME, AUTHOR_NAME , file_type). 이를 위해 listView에서 각 행의 크기를 늘려야합니다. 목록보기에서 행 크기를 늘리려면 어떻게해야합니까 ?? 도발을 좀하십시오 ....

+0

시도 이미지를 요구 사항에 맞는 몇 가지 값으로 –

+0

나는이 아이디어를 좋아하지 않는다. 다른 아이디어를 가지고 앞으로 나올 수 있습니까? –

답변

0

row_layout.xml ~ wrap_content (또는 더 큰 정적 값)에 루트 레이아웃의 높이를 설정하기 만하면됩니다.

android:height="wrap_content" 

는 (좀 더 구체적인 도움이 필요하면, 당신은 row_layout.xml를 게시해야합니다.)


이있는 LinearLayout의 height 속성을 모두 변경해보십시오 :의 크기를 변경

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    ... 
    /> 
+0

귀하의 진술을 이해할 수 없습니다. 좀 더 말해 줄 수 있니? 토론의 편의를 위해 "row_layout.xml"코드가 추가되었습니다. –

+0

잠시만 기다려주세요. 확인하고 있습니다. ..... –

관련 문제