如何在RVAdapter中使用DialogPlus?

时间:2016-09-01 04:37:53

标签: android android-recyclerview recycler-adapter

我使用此库 https://github.com/orhanobut/dialogplus 。如何在DialogPlus中使用和调用RV的位置。

public class ItemViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        Button btn_edit, btn_delete;

        public ItemViewHolder(View itemView) {
            super(itemView);
            .
            .
            .              
            btn_edit = (Button) itemView.findViewById(R.id.btn_edit);
            btn_delete = (Button) itemView.findViewById(R.id.btn_delete);
            btn_edit.setOnClickListener(this);
            btn_delete.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {
            if (v.getId() == btn_edit.getId()) {
                DialogPlus dialog = DialogPlus.newDialog(context)
                   .setContentHolder(new ViewHolder(R.layout.dialog_edit))
                   .create();
                dialog.show();
            EditText brandName = (EditText) dialog.getHolderView().findViewById(R.id.brandName);
            EditText price = (EditText) dialog.getHolderView().findViewById(R.id.price);
            }
        }
    }

1 个答案:

答案 0 :(得分:1)

您可以使用此库 点击here 到那时你可以做到这一点

 CustomLayoutDialog dialog = new DialogPlusBuilder().buildCustomLayoutDialog(R.layout.dialog_edit);
                dialog.showNow(getChildFragmentManager(), "dialog_edit");
 DialogEditBinding languageDialogBinding=(DialogEditBinding) dialog.getCustomLayoutBinding();
 languageDialogBinding.recycler.set(...);