我正在尝试从viewpager片段中显示一个dialogfragment。由于某些原因。唯一出现的是积极的ok按钮。有人可以帮助我吗?
我的片段里面。我在打电话。
DialogFragment cardDetails = CardDetails_Fragment.newInstance(cardItem);
cardDetails.show(getActivity().getSupportFragmentManager(), "card_details");
这是我的onCreateDialog方法。
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mContext = getActivity();
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.fragment_card_details, null);
TextView cardAttempts = (TextView) view.findViewById(R.id.card_attempts);
cardAttempts.setText(Integer.toString(_card.attempts));
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
builder.setCancelable(false);
return builder.create();
}
这就是我得到的。