I use the same name with this question because, in my opinion, my question is very similar to this question, I read and tested the accepted answer very carefully, however the accepted answer does not work for me. Let me describe my question:
My code looks like this:
EditText myEdit = (EditText) this.findViewById(R.id.myedit); myEdit.setText("a\nb\n"); Spannable s = myEdit.getText(); s.setSpan(new BulletSpan(30), 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); s.setSpan(new BulletSpan(30), 2, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); s.setSpan(new BulletSpan(30), 4, 4, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); myEdit.setText(s);
What I want to see:
- but
- b
- [I want to see the 3rd bullet here, but it does not appear]
I tried Spannable.SPAN_INCLUSIVE_INCLUSIVE , Spannable.SPAN_INCLUSIVE_EXCLUSIVE , Spannable.SPAN_EXCLUSIVE_INCLUSIVE , Spannable.SPAN_EXCLUSIVE_EXCLUSIVE , but none of these flags work for me.
And if I use these codes:
EditText myEdit = (EditText) this.findViewById(R.id.myedit); myEdit.setText("a\nb\nc"); Spannable s = myEdit.getText(); s.setSpan(new BulletSpan(30), 0, 1, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); s.setSpan(new BulletSpan(30), 2, 3, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); s.setSpan(new BulletSpan(30), 4, 5, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); myEdit.setText(s);
Then I get the expected result:
I am working on a text editor, when the user clicks the bullet icon, I need to show a blank mark, but now I'm not sure what the problem is, because I want to create a new blank BulletSpan (only with a dot, but there are no characters after it), but if in the beginning and end of the range there are no characters, the point is not displayed.