2014-04-08 3 views
0

목록 항목에서 ImageView를 타겟팅하여 배경색을 설정하려고했지만 행운이 없습니다.목록 항목에서 ImageView 대상 지정

이것은 지금까지 아무 것도하지 않는 경로입니다. 내 customListAdapter에 코드를 작성해야할까요? 많은 ListItems에 대한

listView.getChildAt(0).findViewById(R.id.leftBar).setAlpha(0.3f); 

데이터가 Object에서 채워되고, 차라리 내가이 그것을 (MVC 생각)하고 가야하는 잘못된 방법이다 생각하고 있기 때문에 객체의 코드를 추가 할 것 그래서 내 listAdapter에 코드를 넣는 것이 올바른 일일 수 있다고 생각하는 이유는 무엇입니까?

public View getView(int position, View convertView, ViewGroup parent) {LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 

    View rowView = inflater.inflate(R.layout.list_item, parent, false); 

View iv = rowView.findViewById(R.id.leftBar); 


    if (position == ListView.currentStage){ 
     iv.setBackgroundColor(getContext().getResources().getColor(R.color.Green)); 
    } else if (position < ListView.currentStage){ 
     iv.setBackgroundColor(getContext().getResources().getColor(R.color.Red)); 
    }else if (position > ListView.currentStage) { 
     iv.setBackgroundColor(getContext().getResources().getColor(R.color.Peach)); 
    } 
: 내 ListAdapter에서

답변

0

는 나는이 이미지 뷰를 대상으로 다음 사용
관련 문제