SansSerif FontFamily in jetpack compose

    android:fontFamily="sans-serif"           // roboto regular  
    android:fontFamily="sans-serif-light"     // roboto light  
    android:fontFamily="sans-serif-condensed" // roboto condensed  
    android:fontFamily="sans-serif-thin"      // roboto thin (android 4.2)  
    android:fontFamily="sans-serif-medium"    // roboto medium (android 5.0)

Is FontFamily.SansSerif same as Roboto font in Jetpack Compose also?


The short answer is yes, referencing sans-serif is using Roboto, for Compose as well as for the old View-based UI system in Android.

In the context of Compose, it's important to understand that this is only true now and for Android. Roboto is a sans-serif typeface, and by referencing sans-serif you're really referring to the current sans-serif type the system you're working on uses. It could potentially change in the future. And it could be different if you're running the code in web or desktop (e.g. Helvetica).