_Set_Data_List = new List<string>()
{ { _HL_List[_HL_Default], _Ring_List[_Ring_Default], _VectTime_List[_VectTime_Default], _VectMode_List[_VectMode_Default], _WPT_List[_WPT_Default], _OS_List[_OS_Default],
"TARGET ALARM", "GUARD ZONE", "FUNC BARGE", "TX STBY", "", "◁"};
_DrawerAdapter = new ArrayAdapter<string>(_Context, Resource.Layout.Custom_DrawerList, Resource.Id._Custom_DrawerList_Text, _Set_Data_List);
_IA_List.Adapter = _DrawerAdapter;
private static void _IA_List_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
{
//switch (e.Position)
//{
// // case 0:
// // if (_HL_Default < 4)
// {
// // _HL_Default++;
// }
// // else if (_HL_Default == 4)
// {
// // _HL_Default = 0;
// }
// // //_DrawerAdapter.Remove(_Set_Data_List[0]);
// // //_Set_Data_List[0] = _HL_List[_HL_Default];
// // //_DrawerAdapter.Insert(_Set_Data_List[0], 0);
// // break;
}
This is the code I used before, and I deleted the contents of ListView and updated it again like this.
Current code is
static int _HL_Default = 0;
static string[] _HL_Small_List = { "OFF", "1", "2", "3", "4" };
static int _Big_Data = 0;
static string[] _Big_List = { "HL", "RING", "VECT TIME", "VECT MODE", "WPT MARK", "OS", "◁" };
DrawerListAdapter _Adatper = new DrawerListAdapter(mContext);
DrawerListItem _Item;
for (int i = 0; i < 10; i++)
{
_Item = new DrawerListItem();
_Item.GetSmall = _Big_List[_Big_Data];
switch(_Big_Data)
{
case 0:
_Item.GetBig = _HL_Small_List[_HL_Default];
break;
case 1:
_Item.GetBig = _Ring_Small_List[_Ring_Default];
break;
case 2:
_Item.GetBig = _VectTime_Small_List[_VectTime_Default];
break;
case 3:
_Item.GetBig = _VectMode_Small_List[_VectMode_Default];
break;
case 4:
_Item.GetBig = _WPT_Small_List[_WPT_Default];
break;
case 5:
_Item.GetBig = _OS_Small_List[_OS_Default];
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
}
_Adatper.AddItem(_Item);
_Big_Data++;
}
_IA_List.Adapter = _Adatper;
I used ViewHolder to set the content differently in different sizes using two texts in one list. If you click 0 on the list, it doesn't open up a new page What should I do to make another event appear when the text that says HL OFF changes to HL 1?
custom listview
When you click the item, you can find out position
and then change the value of the dataSet bound to adapter
, that is, List
to the desired value, and then call adapter.notifyDataSetChanged()
to update.
© 2024 OneMinuteCode. All rights reserved.