Sets the text that this TextView is to display (see setText(CharSequence)) and also sets whether it is stored in a styleable/spannable buffer and whether it is editable.
1. Find a TextView using ID
2. In the MainActivity.java file, add the code below to the onCreate method
myEditText.setText("This is new text from setText with BufferType EDITABLE.", TextView.BufferType.EDITABLE);
3. All BufferType options:
TextView.BufferType.EDITABLE
TextView.BufferType.NORMAL
TextView.BufferType.SPANNABLE
4. Compile and run!
5. There is a bug in Android that a TextView will not reset the size the font size is decreased. This fixes the problem. (workaround for Android bug #17343 and #22493)
myTextView.setText(myTextView.getText(),TextView.BufferType.SPANNABLE);
Related Articles:
Resources:
http://developer.android.com/reference/android/widget/TextView.html#attr_android:bufferType
http://developer.android.com/reference/android/widget/TextView.html#setText(java.lang.CharSequence, android.widget.TextView.BufferType)
http://developer.android.com/reference/android/widget/TextView.BufferType.html
http://stackoverflow.com/questions/4590957/how-to-set-text-in-an-edittext
http://stackoverflow.com/questions/21388434/textview-and-size-after-settext
http://developer.android.com/reference/android/widget/TextView.html#setText(java.lang.CharSequence, android.widget.TextView.BufferType)
http://developer.android.com/reference/android/widget/TextView.BufferType.html
http://stackoverflow.com/questions/4590957/how-to-set-text-in-an-edittext
http://stackoverflow.com/questions/21388434/textview-and-size-after-settext