Is this possible to set different textSize in one TextView? I know that I can change text style using:
TextView textView = (TextView) findViewById(R.id.textView); Spannable span = new SpannableString(textView.getText()); span.setSpan(arg0, 1, 10, arg3); textView.setText(span)
I know the range start...end of text I want to change size. But what can I use as arg0
and arg3
?
Default setting lets the autosizing of TextView scale uniformly on horizontal and vertical axes. To define the default setting programmatically, call the setAutoSizeTextTypeWithDefaults(int autoSizeTextType) method.
TextView tv1 = (TextView)findViewById(R. id. textView1); tv1. setText("Hello"); setContentView(tv1);
This is the shortest solution: final CharSequence text = tv. getText(); final SpannableString spannableString = new SpannableString( text ); spannableString. setSpan(new URLSpan(""), 0, spannableString.
Try
span.setSpan(new RelativeSizeSpan(0.8f), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With