Repository navigation
Not styleable? #848
Replies: 1 comment
|
You're not missing anything — Balloon intentionally does not support Android's XML The idiomatic replacement for "styling" in Balloon is to create a reusable builder function that encapsulates your app's visual language. This is the pattern the docs and samples use: Reusable style function// Define once, reuse everywhere — this is your "Balloon style"
fun Context.createAppTooltipBuilder(): Balloon.Builder =
Balloon.Builder(this)
.setArrowOrientationRules(ArrowOrientationRules.ALIGN_ANCHOR)
.setArrowPositionRules(ArrowPositionRules.ALIGN_ANCHOR)
.setWidth(BalloonSizeSpec.WRAP)
.setHeight(BalloonSizeSpec.WRAP)
.setPadding(12)
.setMarginHorizontal(16)
.setCornerRadius(8f)
.setBackgroundColorResource(R.color.tooltip_background)
.setTextColorResource(R.color.tooltip_text)
.setTextSize(14f)
.setBalloonAnimation(BalloonAnimation.FADE)
// ... anything else that's global to your style
// Usage
val balloon = requireContext().createAppTooltipBuilder()
.setText("Specific tooltip text for this spot")
.build()In Compose, use
|
Uh oh!
There was an error while loading. Please reload this page.
With a UI component like this I was expecting it to be styleable. That feels more "Android-y" than calling DSL functions, or having to wrap them up in a function that returns a balloon according to my UI's style.
But that doesn't seem to be possible. Am I missing something?
All reactions