Hello i'm developing simple todo list app..and I ran into this problem I want to show checkbox Dynamically but since i created it in my xml with following attributes...it is automatically shown and <CheckBox android:visibility="gone" android:layout_marginLeft="5dp" android:layout_marginTop="0dp" android:layout_width="353dp" android:layout_height="wrap_content" android:id="@+id/checkBox" android:checked="false" />
when i played with it,i figured out that listView's first row is being shown
i tried to change the visibility of checkbox but i think it is the issue with list view..
static class ViewHolder{
TextView textView;
ViewHolder(View v){
textView = (TextView) v.findViewById(R.id.textView);
}
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row= convertView;
ViewHolder holder = null;CheckBox checkBox;
if(row == null){//1st time
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.single_row,parent,false);
holder = new ViewHolder(row);
row.setTag(holder);
}
else{//recycling
holder = (ViewHolder) row.getTag();
}
MainActivity.Task singleTask= list.get(position);
holder.textView.setText(singleTask.getNote());
checkBox = (CheckBox) row.findViewById(R.id.checkBox);
//if(position >=0)
// checkBox.setVisibility(View.VISIBLE);
return row;
}
this is my arrayAdapter class... please help me with this...thanks in advance!!
Aucun commentaire:
Enregistrer un commentaire