0
ちょうど私がABCの位置を同時に変更しているときにリストビューの位置を変更した後にテキストの色を変更するとアプリが作成されます新しい位置ABC "Assigning"を "Assigned"テキストに変更し、割り当てられた色を赤に変更します。 私を助けてください。テキストビューの位置を変更する方法textviewの色を変更する
private class CurrentEmployeeAdapter extends BaseAdapter {
Context context;
int layoutId;
LayoutInflater liCurrentEmp;
public CurrentEmployeeAdapter(CurrentEmployee currentEmployee, int activity_current_employee) {
this.context=currentEmployee;
this.layoutId=activity_current_employee;
liCurrentEmp=LayoutInflater.from(context);
}
@Override
public int getCount() {
return SalesManNameArrayList.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
View v;
if (convertView==null){
convertView=liCurrentEmp.inflate(R.layout.current_employee_items,parent,false);
v=convertView;
}else {
v=convertView;
}
TextView tvEmpName=(TextView)v.findViewById(R.id.tv_salesman_name);
final TextView tvassingwork=(TextView)v.findViewById(R.id.tv_assign_word);
Button btnAssign=(Button)v.findViewById(R.id.btn_assign);
btnAssign.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
tvassingwork.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (assignNo==1) {
tvassingwork.setText("Assigning");
tvassingwork.setTextColor(getResources().getColor(R.color.green));
assignNo=0;
}else {
int i=position+1;
if(i >0) {
String moveName = SalesManNameArrayList.get(position);
SalesManNameArrayList.set(position, SalesManNameArrayList.get(position));
SalesManNameArrayList.remove(position);
SalesManNameArrayList.add(SalesManNameArrayList.size(), moveName);
tvassingwork.setText("Assigned");
tvassingwork.setTag(position-1);
tvassingwork.setTextColor(getResources().getColor(R.color.red));
assignNo=1;
notifyDataSetChanged();
}
}
}
});
tvEmpName.setText(SalesManNameArrayList.get(position));
return convertView;
}
}
変更した後に変更することができます。割り当てられた色の変更のみをクリックして位置を変更します。ABCの位置は変更されません。 – Neil
申し訳ありません。あなたが言ったことを理解できないのですか? –
Sathish、私がテキストを割り当てるのをクリックすると、ABCの位置がリストビューの最後に変わります。それと同時に、私は同じ行を色を使ってassingedテキストに譲るように変更したい – Neil