sweet-alert-dialog
sweet-alert-dialog copied to clipboard
add custom views?
Hi,
I seems a can't add any custom views... I tried using "setContentView" and "addContentView" for no result, I also see no api for that. I'm trying to add a EditText.
this version doesnt have such feature, check forks or check this https://github.com/pedant/sweet-alert-dialog/pull/100 Probably will upload my improved version of this library
My improved version with custom view and other new features https://github.com/F0RIS/sweet-alert-dialog
adding a custom view:
final EditText editText = new EditText(mActivity);
SweetAlertDialog dialog = new SweetAlertDialog(mActivity, SweetAlertDialog.NORMAL_TYPE)
.setTitleText("title")
.setContentText("content")
.setConfirmText("confirme")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sweetAlertDialog) {
String text = editText.getText().toString();
}
sweetAlertDialog.dismiss();
}
});
dialog.show();
LinearLayout linearLayout = (LinearLayout)dialog.findViewById(R.id.loading);
int index = linearLayout.indexOfChild(linearLayout.findViewById(R.id.content_text));
linearLayout.addView(editText, index+1);
why FrameLayout ? Can you make it LinearLayout ? It does not wrap long text (more than 5 lines) properly. @F0RIS
@ralphgabrielle need to make tests with that change. Can you do that?
@F0RIS ok ill try to do this later this evening. If it does not work with LinearLayout, I guess I gotta think another fix for this.