쭌2 블로그

[안드로이드/Android] 글자 단위 자동 개행 TextView 본문

IT/Android

[안드로이드/Android] 글자 단위 자동 개행 TextView

realjune 2019. 6. 17. 11:16

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

public class CharacterWrapTextView extends android.support.v7.widget.AppCompatTextView {

    public CharacterWrapTextView(Context context) {

        super(context);

    }

 

    public CharacterWrapTextView(Context context, AttributeSet attrs) {

        super(context, attrs);

    }

 

    public CharacterWrapTextView(Context context, AttributeSet attrs, int defStyleAttr) {

        super(context, attrs, defStyleAttr);

    }

 

    @Override

    public void setText(CharSequence text, BufferType type) {

        super.setText(text.toString().replace(" ""\u00A0"), type);

    }

}

Colored by Color Scripter

cs
Comments