0
ListActivity를 확장하는 EfficientAdapter를 사용하고 있습니다. 어떤 이유 , 나는 다음과 같은 코드를 사용할 때 :EfficientAdapter 및 텍스트 형식
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.list_item_icon_text, null);
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.text);
holder.text.setPadding((int) (Vars.screenWid-300), 30, 0, 30);
if (position==1){
holder.text.setPadding(20, 0, 20, 0);
holder.text.setBackgroundColor(Color.DKGRAY);
}else{
holder.text.setPadding(20, 20, 20, 20);
holder.text.setBackgroundColor(Color.TRANSPARENT);
}
}
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.text.setText(String.valueOf(Vars.DATAMIN[position]));
return convertView;
}
나는 목록을 대신 Color.DKGRAY 그냥 항목 1, 나는 다른 항목에 RANDOMALLY 그것을 얻을. 위아래로 스크롤하여 한 항목에서 다른 항목으로 배경 변경 사항을 봅니다. 아이디어가 있습니까?