如何删除Android的notelist项?

如何删除Android的notelist项?,android,Android,我学习了如何为注释列表添加列表项,但我找不到任何关于如何删除列表项的教程,有人能教我吗?如何从列表中删除该项目 btnSimple.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //this remove the first view.You can remove view by inde

我学习了如何为注释列表添加列表项,但我找不到任何关于如何删除列表项的教程,有人能教我吗?如何从列表中删除该项目

btnSimple.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //this remove the first view.You can remove view by index.
                noteList.remove(0);
                aa.notifyDataSetChanged();
                myEditText.setText("");
            }
        });
这是我的note_add.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/myEditText"
        android:text="New To Do Item">
        </EditText>

    <Button
        android:layout_width="150dp"
        android:layout_height="50dp"
        android:id="@+id/btnSimple"
        android:text="Add Note"
        android:textAlignment="center"
        android:layout_below="@+id/myEditText"
        android:layout_toLeftOf="@+id/bDeleteNote"
        android:layout_toStartOf="@+id/bDeleteNote"
        android:layout_marginRight="66dp"
        android:layout_marginEnd="66dp" />
    <Button
        android:layout_width="150dp"
        android:layout_height="50dp"
        android:id="@+id/bDeleteNote"
        android:text="Delete"
        android:layout_gravity="right"
        android:textAlignment="center"
        android:layout_alignTop="@+id/btnSimple"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true" />



    <ListView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/myListView"
        android:layout_below="@+id/bDeleteNote">

    </ListView>

</RelativeLayout>

这是我的note.java

import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

import java.util.ArrayList;

public class Note extends HomePage {
    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.notes_add);

        ListView myListView = (ListView) findViewById(R.id.myListView);
        final EditText myEditText = (EditText)findViewById(R.id.myEditText);
        final ArrayList<String> noteList = new ArrayList<String>();
        final ArrayAdapter<String> aa;
        aa = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,noteList);
        myListView.setAdapter(aa);
        Button btnSimple = (Button) findViewById(R.id.btnSimple);
        btnSimple.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                noteList.add(0,myEditText.getText().toString());
                aa.notifyDataSetChanged();
                myEditText.setText("");
            }
        });


    }
}
导入android.os.Bundle;
导入android.view.view;
导入android.widget.ArrayAdapter;
导入android.widget.Button;
导入android.widget.EditText;
导入android.widget.ListView;
导入java.util.ArrayList;
公开课讲稿扩展网页{
@凌驾
创建公共void(Bundle){
super.onCreate(bundle);
setContentView(R.layout.notes\u add);
ListView myListView=(ListView)findViewById(R.id.myListView);
final EditText myEditText=(EditText)findViewById(R.id.myEditText);
final ArrayList noteList=新ArrayList();
最终阵列适配器aa;
aa=新的ArrayAdapter(这是android.R.layout.simple\u list\u item\u 1,noteList);
myListView.setAdapter(aa);
按钮btnSimple=(按钮)findViewById(R.id.btnSimple);
btnSimple.setOnClickListener(新视图.OnClickListener(){
@凌驾
公共void onClick(视图v){
添加(0,myEditText.getText().toString());
aa.notifyDataSetChanged();
myEditText.setText(“”);
}
});
}
}

如何删除列表中的项目

这真的花了我2秒钟去谷歌。谢谢你:)这对初学者来说真的很清楚,非常感谢
btnSimple.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //this remove the first view.You can remove view by index.
                noteList.remove(0);
                aa.notifyDataSetChanged();
                myEditText.setText("");
            }
        });