I am trying to show furigana (small text helping for pronunciation) above kanji using Jetpack Compose.
I have searched on the Web but all tools are designed to be used with Java.
You can use Android Compose Furigana to put furigana on text.
Here is how to use it:
dependencies {
implementation 'com.github.mainrs:android-compose-furigana:1.0.0'
}
Or, in Gradle Kotlin DSL
dependencies {
implementation("com.github.mainrs:android-compose-furigana:1.0.0")
}
import net.zerotask.libraries.android.compose.furigana.TextData
import net.zerotask.libraries.android.compose.furigana.TextWithReading
@Composable
internal fun Content(){
val textContent = listOf(
TextData(text = "これは")
TextData(text = "漢字", rading = "かんじ")
TextData(text = "です")
)
TextWithReading(textContent = textContent, showReadings = true)
}