Android TextView首行缩进

public 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;
}

调用时:

myTextView.setText(createIndentedText("my text that's gonna be indented", 10, 10));

你可能感兴趣的:(Android TextView首行缩进)