F0RIS/sweet-alert-dialog

setContentText display cutted text without last line

mastromarke opened this issue · 5 comments

Hi, in some case I noticed the last line in dialog is cutted, whether you use setContentText() or use setCustomView(textView). It isn't cutted at fixed number of lines it's vary from the lenght of the last line.
It is not cut to a fixed number of lines, but changes according to the length of the last line, I think.
One example is:
final SweetAlertDialog koDialog = new SweetAlertDialog(MainActivity.this, SweetAlertDialog.ERROR_TYPE)
.setTitleText(getResources().getString(R.string.ko_error))
.setContentText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam
interdum commodo felis, et lobortis quam interdum at. ")
.setConfirmText(getResources().getString(android.R.string.ok));
koDialog.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@OverRide
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismissWithAnimation();
}
});
koDialog.setCancelable(false);
koDialog.show();
Try with different text and check if the last word is visible. I've also tried by adding concat("\n") but sometimes also this method dosen't work.

There is another problem if I set ratingbar inside a customview sometimes the last star is cutted.

Thanks

any suggestions?

F0RIS commented

This is known bug. Try use smaller text size, or set custom view. But if you have time, you can try fix this and make PR

try this

final TextView editText = new TextView(context);
editText.setText(content);
SweetAlertDialog dialog = new SweetAlertDialog(context, SweetAlertDialog.ERROR_TYPE)
.setTitleText(title)
.setCustomView(editText);
dialog.show();

This happens to me too, also if I do what @DhanushkaBasnayaka said. Anyone could solve it?
Thanks

This could be solved if Textview with id content_text has layout_width=wrap_content