/HighlightTextView

A TextView with light-highlighting.

Primary LanguageKotlinApache License 2.0Apache-2.0

HighlightTextView

A TextView with lightweight-highlighting.

Demo

Base Color Width Radius

Gradle

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
        implementation 'com.github.minseok-kr:HighlightTextView:1.2.0'
}

Usage

Xml

<com.minseok.hightlight.HighlightTextView
        android:id="@+id/text_sample_sentence"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/default_margin"
        android:text="Lorem ipsum dolor sit amet,"
        android:textSize="25sp"
        app:highlightText="ipsum,dolor"
        app:highlightTextColor="@color/red"
        app:highlightBold="true"
        app:highlightWidth="8dp"
        app:highlightRadius="4dp"/>

Kotlin

val highlightView = findViewById<HighlightTextView>(R.id.highlight_view)
val input = findViewById<EditText>(R.id.input)
input.addTextChangedListener {
    highlightView.highlight(it.toString())
}

+

  • Light, Fast highlighting than Spannable case.

-

  • Working only for a single line
  • Not stable yet

Soon

  • Support rounded corners of highlight
  • Support a highlight of multiline
  • Support a highlight of mulitword