내 디스플레이 어댑터에서 필자는 데이터베이스의 데이터를 시각화합니다. TextView 턴과 관련된 열의 M 값이 빨간색으로 표시되기를 바랍니다. 어떻게해야합니까?문자열 값을 기반으로 색상을 지정하는 방법
public DisplayAdapter(Context c, ArrayList<String> id,ArrayList<String> ore,ArrayList<String> turno) {
this.mContext = c;
this.id = id;
this.turnoName = turno;
this.oreName = ore;
}
public int getCount() {
// TODO Auto-generated method stub
return id.size();
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
public View getView(int pos, View child, ViewGroup parent) {
Holder mHolder;
LayoutInflater layoutInflater;
if (child == null) {
layoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
child = layoutInflater.inflate(R.layout.row, null);
mHolder = new Holder();
mHolder.txt_turno = (TextView) child.findViewById(R.id.txt_turno);
mHolder.txt_ore = (TextView) child.findViewById(R.id.txt_ore);
mHolder.txt_id = (TextView) child.findViewById(R.id.txt_id);
child.setTag(mHolder);
} else {
mHolder = (Holder) child.getTag();
}
mHolder.txt_turno.setText(turnoName.get(pos));
mHolder.txt_ore.setText(oreName.get(pos));
return child;
}
public class Holder {
TextView txt_turno;
TextView txt_ore;
TextView txt_id;
}
}
당신의 질문이 확실하지 않습니다 –
난 열의 M 값이 바뀌기를 바란다. – user3461181
'나는 TextView 차례에 비례하여 칼럼의 M 값을 원한다. 평균? –