我有一个ListView,它从Strings.xml String Array中检索和显示数据。 我想知道如果我点击ListView中的String,我将如何从Strings.xml数组中删除一个字符串。
MainActivity:
public class MainActivity : Activity
{
ListView notesList;
String[] notesArray;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
ActionBar.Hide();
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
notesArray = Resources.GetStringArray(Resource.Array.testStrings);
notesList = FindViewById<ListView>(Resource.Id.lvNotes);
//Load ListView Data
ArrayAdapter adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleExpandableListItem1, notesArray);
notesList.Adapter = adapter;
}
}
}
和Strings.xml: