EmphasisTextView

Additional

Language
Java
Version
v0.4.0 (Oct 3, 2016)
Created
Sep 20, 2015
Updated
Oct 4, 2016 (Retired)
Owner
Sakis Kaliakoudas (athkalia)
Contributors
Ravindra Kumar (ravidsrk)
Sakis Kaliakoudas (athkalia)
2
Activity
Badge
Generate
Download
Source code
APK file

Show card

EmphasisTextView

An android TextView that supports highlighting parts or all of the text contained in it.

Screenshots

How to

To set the highlight areas you can add the following statements programmatically:

emphasisTextView.setText("SALAD");
emphasisTextView.setTextToHighlight("sa");
emphasisTextView.setHighlightColor("#ff3393b4"); 
emphasisTextView.setCaseInsensitive(true);
emphasisTextView.highlight();

Please check the sample project for some more working examples.

Add it to your project

This library is hosted in jcenter

For gradle, you can import it with:

dependencies {
    compile 'com.athkalia.emphasis:emphasis:0.4'
}

For maven, you can import it with:

<dependency>
    <groupId>com.athkalia.emphasis</groupId>
    <artifactId>emphasis</artifactId>
    <type>aar</type>
    <version>0.4</version>
</dependency>

Todos

Feel free to open a pull request for anything that you want to see added.

What I have in mind:

  1. Introduce a delegate when someone is using another class that is already extending from TextView (possibly another library).

  2. Create similar functionality via xml attributes.