Add inline CarIcons for rows
Stay organized with collections
Save and categorize content based on your preferences.
You can add icons inline with text to enrich your app's visual appeal using
CarIconSpan. See the documentation for CarIconSpan.create for more
information on creating these spans. See Spantastic text styling with Spans
for an overview of how text styling with spans work.
valrating=SpannableString("Rating: 4.5 stars")rating.setSpan(CarIconSpan.create(// Create a CarIcon with an image of four and a half starsCarIcon.Builder(IconCompat.createWithResource(carContext,R.drawable.ic_star)).build(),// Align the CarIcon to the baseline of the textCarIconSpan.ALIGN_BASELINE),// The start index of the span (index of the character '4')8,// The end index of the span (exclusive, length of the string)17,Spanned.SPAN_INCLUSIVE_INCLUSIVE)valrow=Row.Builder().setTitle("Rating Row").addText(rating).build()
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-06-24 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-24 UTC."],[],[]]