If you want to provide the user with a way to start a counter from each line of the list, one approach would be to use a custom view, such as the following SpinnerRow:
public class SpinnerRow : RelativeLayout, View.IOnClickListener, IDialogInterfaceOnClickListener
{
SpinnerItemSelectedDelegate _spinnerItemSelected;
SpinnerPosSelectedDelegate _spinnerPosSelected;
private TextView _label;
private TextView _value;
private ImageButton _edit;
private string[] _options = new String[0];
private int _position;
private AlertDialog.Builder _builder;
public SpinnerRow (Context context) :
base (context)
{
Initialize (context, null);
}
public SpinnerRow (Context context, IAttributeSet attrs) :
base (context, attrs)
{
Initialize (context, attrs);
}
protected SpinnerRow (IntPtr doNotUse, Android.Runtime.JniHandleOwnership owner) :
base (doNotUse, owner)
{
//Do nothing
}
protected void Initialize (Context context, IAttributeSet attrs)
{
Inflate (context, Resource.Layout.SpinnerRow, this);
_label = FindViewById<TextView>(Resource.Id.editscope_addons_spinner_row_lbl);
_value = FindViewById<TextView>(Resource.Id.editscope_addons_spinner_row_spin_lbl);
_edit = FindViewById<ImageButton>(Resource.Id.editscope_addons_spinner_row_button);
_label.Text = "Row label";
string[] options = {"None", "Id", "Customer Name", "Customer Number", "City", "Address", "Credit Limit", "Contact Name", "Phone Number", "Mail"};
_options = options;
_edit.SetOnClickListener(this);
_builder = new AlertDialog.Builder(context);
_builder.SetTitle(_label.Text);
}
public virtual void OnClick(View v)
{
_builder.SetSingleChoiceItems(_options, _position, this);
_builder.Create().Show();
}
public virtual void OnClick(IDialogInterface dialog, int position)
{
Position = position;
_value.Text = _options[_position];
dialog.Dismiss();
}
public int IndexOf(string option)
{
int numOptions = _options.Length;
for (int i = 0; i < numOptions; i++)
{
if (_options[i].ToLower() == option.ToLower())
return i;
}
return IntentConstants.INVALID_POSITION;
}
public bool Contains(string option)
{
return IndexOf(option) != IntentConstants.INVALID_POSITION;
}
public string Text
{
get { return _label.Text; }
set { _label.Text = value; }
}
public int Position
{
get { return _position; }
set
{
_position = value;
if (_position == IntentConstants.INVALID_POSITION)
{
_value.Text = NotSelectedText;
if (OnSelected != null)
OnSelected("");
}
else if (_options != null && _options.Length > 0)
{
_value.Text = _options[_position];
if (OnSelected != null)
OnSelected(_options[_position]);
}
if (OnPosSelected != null)
OnPosSelected(_position);
}
}
public string ValueText
{
get { return _value.Text; }
}
public String[] Options
{
get { return _options; }
set
{
_options = value;
//Reset the current position so the text is updated
int curPos = Position;
_position = IntentConstants.INVALID_POSITION;
Position = curPos;
}
}
public SpinnerItemSelectedDelegate OnSelected
{
get { return _spinnerItemSelected; }
set { _spinnerItemSelected = value; }
}
public SpinnerPosSelectedDelegate OnPosSelected
{
get { return _spinnerPosSelected; }
set { _spinnerPosSelected = value; }
}
}
You would initialize this view in the GetView () of your CustomizeColumnsListAdapter above.
, , , , - ViewHolder, Android: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html