Я создал пользовательский класс textview, и я использую BackgroundColorSpan для применения цвета в фоновом режиме. Как добавить пустое пространство до и после каждой строки. Я очень ценю любую помощь.Как добавить место в начале и конце каждой строки
final String test_str1 = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.";
public class CustomTextView extends TextView {
public CustomTextView(Context context) {
super(context);
setFont();
}
public CustomTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setFont();
}
public CustomTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setFont();
}
private void setFont() {
Typeface font = Typeface.createFromAsset(getContext().getAssets(), "fonts/TEXT.ttf");
setTypeface(font, Typeface.NORMAL);
Spannable myspan = new SpannableString(getText());
myspan.setSpan(new BackgroundColorSpan(0xFF757593), 0, myString.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
txtview.setText(myspan);
}
}
Вы попробовали .append (""); –
Вы спрашиваете о добавлении пространства в качестве символа ("") или в качестве пробела в макете? – naXa
Возможный дубликат http://stackoverflow.com/questions/6863974/android-textview-padding-between-lines –