2011-11-27 2 views
0

내 목록 어댑터를 정의하고 있는데 그 안에 이미지가 표시되거나 값에 따라 보이지 않거나 눈에 띄지 않는 값을 기반으로 숨겨 지도록합니다.사용자 지정 어댑터 내에서 ImageView를 invisable로 설정

여기 내 코드입니다,이 코드는 한 번 INVISIBLE로 설정 한 후 당신은 결코 VISIBLE에 다시 read 이미지를 설정하지있는의 getView 방법

singleRow=data.get(position); 
    readit = singleRow.getRead(); 
    Log.i("readit","" + readit); 
    //NotificationID=singleRow.getId(); 
    holder.title.setText(singleRow.getAttach_title()); 
    holder.date.setText(singleRow.getAttach_created()); 
    holder.dueDate.setVisibility(ImageView.INVISIBLE); 
    holder.course.setText(singleRow.getCourse_title()); 

    if(readit==1) 
      { 
       //holder.read.setImageResource(IGNORE_ITEM_VIEW_TYPE); 
       holder.read.setVisibility(ImageView.INVISIBLE); 
      } 
      else 
      { 
       holder.read.setImageResource(R.drawable.unread); 
      } 
+0

한 가지 더를 해결할 것입니다, 난 그냥 사용할 수 없습니다 setImageResource (1)가 엉망 전체 인터페이스를하기 때문에 –

답변

0

안에 있습니다. else에서 당신은, 아마도, setVisibility(VISIBLE)

+0

고맙다.하지만 공간은 사라지고 UI는 엉망이다. ( –

+0

당신은 보이지 않는 대신에 시도해 볼 수있다. 보이지 않는 이미지는 보이지 않지만 차지하는 장소는 여전히있다. 완전히 사라져 버렸어. 그 외에는 XML을 보지 못한다고 말할 수 없다. –

1
holder.dueDate.setVisibility(View.GONE); 
+0

당신은 어떻게 그걸 의미합니까? –

+0

GONE이 공간을 삭제하고 전체 UI가 엉망이됩니다. 나는 상대적 레이아웃을 사용하고있다. –

0

사용을해야이 code.It이 문제

singleRow=data.get(position); 
    readit = singleRow.getRead(); 
     Log.i("readit","" + readit); 
    //NotificationID=singleRow.getId(); 
     holder.title.setText(singleRow.getAttach_title());  
     holder.date.setText(singleRow.getAttach_created()); 
    holder.dueDate.setVisibility(ImageView.INVISIBLE);  
     holder.course.setText(singleRow.getCourse_title()); 
     holder.read.setImageResource(R.drawable.unread); 

     if(readit==1) { 
     //holder.read.setImageResource(IGNORE_ITEM_VIEW_TYPE); 
     holder.read.setVisibility(View.INVISIBLE); 
        } 
관련 문제