2014-04-27 5 views
0

사용자 정의 ListView가 있는데 배경색을 적용하려고하는데 목록 항목이없는 영역에만 적용됩니다. 나는 많은 기술을 시도했지만 그것은 나를 위해 작동하지 않습니다. 전체 listview에서 배경색을 만들고 싶습니다. 어떻게 달성 할 수 있는지 알려주세요. 여기이 그 결과Android : ListView 전체 목록보기에 배경색이 적용되지 않습니다.

enter image description here

내 XML 코드

<ListView 
       android:layout_height="fill_parent" 
       android:layout_width="match_parent" 
       android:id="@+id/user" 
       android:scrollingCache="false" 
       android:scrollbars="none" 
       android:cacheColorHint="#00000000" 
       android:background="@android:color/darker_gray" 
       android:overScrollMode="never" 
       android:layout_below="@+id/sub_title"> 

      </ListView> 

입니다 그리고 이것은 내가

enter image description here

+0

처럼 사용하십시오 당신의 품목의 XML 파일에서 이것을 적용 할 수 있습니다. 위에서 달성하기 위해서는 ListView 항목과 동일한 배경을 설정해야합니다. :) –

+0

목록 항목에서 동일한 배경색을 사용해야합니다. 또는 투명 배경으로 목록 자체를 적용하십시오. –

+0

목록 항목에서도 동일한 배경색을 시도했지만 작동하지 않으며 listview에 투명한 색상을 적용하고 부모보기에 배경색을 적용했습니다. –

답변

1

당신의 ListView에 대한 투명한 배경 색상을 사용해보십시오 원하는 것입니다 항목 레이아웃을 변경하거나 목록 항목에서 동일한 배경색을 사용하십시오.

투명 배경 솔루션의 경우,

android:background="@android:color/transparent" 
+0

시도해 보았지만 작동하지 않습니다. –

+0

목록 항목의 레이아웃 파일을 게시 할 수 있습니까? –

0

가 적용지고 있지만 목록 항목에 포함되어이

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/brown" 
    tools:context=".MainActivity" > 

    <ListView 
     android:id="@+id/programsLV" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 
    </ListView> 



</RelativeLayout> 
관련 문제