How do I indent a text line in TextView in android? -
i writing text in android take more 2 lines problem how indent second line text lines are.
1.my name qadeer hussain iam fine how ru.
but want
1.my name qadeer hussain iam fine how ru.
here second line not start right below 1 right below name
use leadingmarginspan.standard
spannablestring
, or if need bullets use bulletspan
:
just create function this:
static spannablestring createindentedtext(string text, int marginfirstline, int marginnextlines) { spannablestring result=new spannablestring(text); result.setspan(new leadingmarginspan.standard(marginfirstline, marginnextlines),0,text.length(),0); return result; }
and then, everytime need indented line can do:
mytextview.settext(createindentedtext("my text that's gonna indented", 10, 10));
the first parameter indentation of first line, second parameter indentation of next lines, in case want indent first line differently following ones.
Comments
Post a Comment