通过点击ListView - Android c#Xamarin从Strings.xml中删除项目

时间:2017-05-19 03:01:57

标签: c# android arrays listview xamarin

我有一个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:

Strings.xml

0 个答案:

没有答案