2012-11-21 7 views
3

왼쪽의 Image와 오른쪽의 텍스트를 포함하는 모든 행을 스크롤 할 수있는 목록을 만들기 위해 다음 요소들로 존재하는 특정 Listview를 만들었습니다. 화면이 (NO 운동으로) 정적 도시되는 한안드로이드 배경 ListView는 스크롤 할 때 검은 색이됩니다

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:background="@drawable/bg_row" 
> 
    <ImageView 
     android:layout_width="wrap_content" 
     android:paddingLeft="10px" 
     android:paddingRight="15px" 
     android:paddingTop="5px" 
     android:paddingBottom="5px" 
     android:layout_height="wrap_content" 
     android:src="@drawable/bg_image" 
    /> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingTop="5px" 
     android:paddingBottom="5px" 
     android:textSize="16sp" 
     android:textColor="#000000" 
     android:layout_gravity="center" 
     android:maxHeight="50px"/> 
</LinearLayout> 

:

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#C8C8C8" 
> 
<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 
<ListView 
    android:id="@android:id/list" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:drawSelectorOnTop="false" 
    android:divider="#C8C8C8" 
    android:background="#C8C8C8"/> 

및리스트 뷰의 행은 XML 코드 저는 아래 주어진 사용하고 :리스트 뷰에 대한 사용이 같다 올바르게 표시되지만, 스크롤을 시작하면 행 항목의 배경 (코드에 표시 될 수있는 "아이콘")이 정확하게 표시되지만 "루트"레이아웃의 배경은 완전히 검은 색이됩니다 ... 스크롤이 배경을 멈출 때 대부분 시대의, 그것의 색상을 돌려받을 ... 나는 또한 동일한 배경으로 그 루트 요소에 TextView를 추가,이 하나는 그것이 목록이 스크롤 될 때 색깔을 억제합니다 ... 왜 이런 일이 일어나고 있는지, 어떻게 해결할 수 있을까요?

답변

0

android:cacheColorHint="#00000000" // setting as a transparent color 
0

당신은 당신의 ListView의 색상과 동일한에있는 ListView의 캐시 색상을 설정해야합니다 ListView에 태그에 속성을 추가 :

<ListView 
    android:id="@android:id/list" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:drawSelectorOnTop="false" 
    android:divider="#C8C8C8" 
    android:background="#C8C8C8" 
    android:cacheColorHint="#C8C8C8" /> 

(!) 참고 : 당신이 원하는 경우 디바이더로 보이지 않는 경우 다음과 같이이 작업을 수행 할 수도 있습니다.

android:divider="@null" 
관련 문제