| Start |
|---|
| Spannable TextView A spannable Consider that you have defined a Then you can apply different highlighting to it as shown below: Output created by the code above:
RelativeSizeSpan can be used, as shown in the following example: Output created by the code above:
TypefaceSpan can be used, as shown in the following example: However, in order to make the above code working, the class |
| TextView with image Android allows programmers to place images at all four corners of a You can set the drawable to any side of your Setting the drawable can also be achieved programmatically in the following way: Setting any of the parameters handed over to |
Strikethrough TextView Strikethrough the entire textOutput: Strikethrough only parts of the textOutput: |
| Make RelativeSizeSpan align to top In order to make a activity_main.xml: MainActivity.java: TopAlignSuperscriptSpan.java: Reference screenshot: |
| Pinchzoom on TextView activity_main.xml: MainActivity.java: |
| Textview with different Textsize You can archive different Textsizes inside a Textview with a Span |
TextView customization Usage: Layout: attars: Programmatically usage: |
| Theme and Style customization MainActivity.java: activity_main.xml: CustomTextView.java: attrs.xml: strings.xml: styles.xml: |
| Single TextView with two different colors Colored text can be created by passing the text and a font color name to the following function: The colored text can then be set to a First, define a Then, create differently colored text and assign it to strings: Finally, set the two differently colored strings to the Reference screenshot: Syntax
RemarksTry to use it in xml design or programmatically. |
Read Article
https://develop.horje.com/learn/1434/reference