2011-05-10 5 views
1

모든 응용 프로그램의 아이콘이 표시되고 GridView에 아이콘이 표시됩니다. GridView는 매우 잘 보여 주지만, GridView를 매우 빠르게 아래로 글라이딩 할 때 GridView에 두 개의 아이콘이없는 경우가 있습니다. 이런 종류의 상황이 자주 나타나지 않는다면 조언을 해줄 수 있습니까?GridView에서 이미지를 표시 할 수 없습니다.

편집 :이 질문은 전에 질문했지만 답변이 없습니다. Scrolling issues with GridView in Android

답변

20

나는 이미지와 텍스트를 표시하려면이 XML을 사용의 GridView의 어댑터, 내 상황에서,이를 해결 한 :

<!-- <LinearLayout android:layout_width="fill_parent" android:layout_height="18dip" /> --> 
    <LinearLayout 
      android:id="@+id/iconBackgroundLinear" 
      android:layout_width="54dip" 
      android:layout_height="57dip" 
      android:gravity="center"> 

     <ImageView 
       android:id="@+id/app_icon" 
       android:layout_width="45dip" 
       android:layout_height="45dip" 
       android:adjustViewBounds="false" 
       /> 
    </LinearLayout> 

    <TextView 
      android:id="@+id/app_title" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:paddingTop="2dip" 
      android:gravity="center_horizontal" 
      android:lines="2" 
      /> 
    </LinearLayout> 

의 핵심은 안드로이드입니다 : 라인 = "2", android : maxline = "2"을 사용하면 위의 실수가 표시 될 수 있습니다.

+0

나는 당신이 단지 운이 좋았다고 생각합니다. 나는 평범한 LinearLayout 요소와 Shape 배경을 가진 ViewSwitcher를 가지고 있는데, 텍스트가없는 동일한 문제가있다. 이상한 안드로이드 버그처럼 보입니다 ... –

+1

이것이 실제로 문제를 해결하는 동안, GridView에 근본적으로 잘못된 점을 암시합니다. 가변 높이 항목이 마음에 들지 않습니까? –

+0

나는 안드로이드 : 선 값을 동일하게 유지하는 것이 좋다고 생각한다. 아마도 질문을 재현 할 수있다. – pengwang

0

내가

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_marginTop="@dimen/big_margin" 
    android:layout_width="match_parent" 
    android:layout_marginLeft="@dimen/big_margin" 
    android:layout_height="@dimen/workoutlist_itemheight"> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_marginTop="@dimen/big_margin" 
    android:layout_width="match_parent" 
    android:layout_marginLeft="@dimen/big_margin" 
    android:layout_height="wrap_content"> 

로 대체이 문제를 해결했지만 정말 내가 내 문제가 해결 않았다 방법을 모르겠어요.

감사합니다.

관련 문제