Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to create 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();
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #listpopupwindow #android #studio
ADD COMMENT
Topic
Name
1+9 =