So erstellen Sie ListPopupWindow Android Studio

private void showListPopupWindow(View anchorView) {
    final ListPopupWindow listPopupWindow = new ListPopupWindow(this);
    listPopupWindow.setWidth(600);
    List<String> sampleData = new ArrayList<>();
    sampleData.add("A");
    sampleData.add("B");
    sampleData.add("CCCCCCCCCCCCCC");
    sampleData.add("D");
    sampleData.add("EEEEEEEEE");

    listPopupWindow.setAnchorView(anchorView);
    ListPopupWindowAdapter listPopupWindowAdapter = new ListPopupWindowAdapter(this, sampleData, new ListPopupWindowAdapter.OnClickDeleteButtonListener() {
        @Override
        public void onClickDeleteButton(int position) {
            Toast.makeText(MainActivity.this, "Click delete " + position, Toast.LENGTH_SHORT).show();
            listPopupWindow.dismiss();
        }
    });
    listPopupWindow.setAdapter(listPopupWindowAdapter);
    listPopupWindow.show();
}
Repulsive Rattlesnake