https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose
  • r

    rkeazor

    09/28/2020, 6:04 AM
    whats the best way to handle routing in compose, navigation component?
    s
    i
    • 3
    • 7
  • m

    Madhava

    09/28/2020, 6:16 AM
    Does anyone know if there is a solution for this, I am having it on Alpha03 with Emulator and LG G6. I am using WebView in AndroidView with Compose Router on a subscreen if that is an issue?
    • 1
    • 1
  • a

    Adriano Celentano

    09/28/2020, 10:02 AM
    Is this a bug or is there a reason why my preview looks different than my emulator ?
    e
    j
    • 3
    • 3
  • a

    allan.conda

    09/28/2020, 10:35 AM
    If I wrap
    AnimatedVisibility
    around the
    TopAppBar
    , I lose the elevation. Is there something else I should be using to toggle it’s visibility?
    j
    • 2
    • 3
  • j

    Julius Marozas

    09/28/2020, 11:42 AM
    Hi, how can I observe when the application is in background? What's the alternative to onStart/onStop lifecycle methods in Compose?
    z
    f
    i
    • 4
    • 4
  • a

    Archie

    09/28/2020, 1:48 PM
    Is there a way to know whether a composable is disposed because it gets removed compared to when it is disposed because the activity holding it gets rotated?
    y
    a
    a
    • 4
    • 16
  • z

    Zach Klippenstein (he/him) [MOD]

    09/28/2020, 1:50 PM
    I did some playing around this weekend with using Compose for layout out and drawing to PDFs. Or in other words, making compose UIs printable. It's not a library yet, just a proof of concept, but there's a thread explaining how it works here: https://twitter.com/zachklipp/status/1310570706174967809?s=19 And here's the code: https://github.com/zach-klippenstein/compose-richtext
    🚀 8
    😎 6
    🔥 22
    ❤️ 4
    👍 6
    👏 38
    n
    • 2
    • 1
  • y

    Yann Badoual

    09/28/2020, 2:14 PM
    Any way to disable by default the new really obnoxious
    Build on save
    settings for preview instead of having to disable it in each file?
    ➕ 2
    j
    r
    +5
    • 8
    • 12
  • g

    Guy Bieber

    09/28/2020, 6:24 PM
    I am trying to set TextStyles by MaterialTheme.typography at init time for a class. Unfortunately, typography is a @Composable function and init cannot be Composable. Any good workarounds for this?
    z
    • 2
    • 6
  • s

    Sam

    09/28/2020, 7:47 PM
    How is everyone handling navigation in their app?
    j
    i
    +2
    • 5
    • 12
  • d

    Daniele B

    09/28/2020, 8:39 PM
    I am doing a multiplatform project, and I am defining the color pallette in the shared view model. Is there a simple function to convert the 6-char RGB string (e.g. “CC6699”) into a 
    androidx.compose.ui.graphics.Color
     object ?
    d
    • 2
    • 2
  • y

    Yann Badoual

    09/29/2020, 11:53 AM
    Is there any way to implement a gradient like this? I tried using radial gradient but without success. I ended up drawing each line manually with a decay from the original color to full transparency. It's far from ideal but it's for a scrim so it does the job.
    c
    g
    • 3
    • 10
  • z

    Zhelyazko Atanasov

    09/29/2020, 5:47 PM
    Hey, I wrote my first Medium article about Jetpack Compose, in particular - everything I know about the
    @Preview
    annotation. My intention was to have a single place with all the bits and pieces I've learned through different blog posts, docs, videos & my experimentations. If this is considered spam, I'm sorry about that and moderators/admins can delete this message. The article is not behind Medium's paywall, so - free for all 🙂 - Link. Any feedback or reporting errors are welcomed.
    🙌 5
    👍 3
    🎉 2
    c
    a
    • 3
    • 2
  • c

    Colton Idle

    09/29/2020, 5:52 PM
    I haven't been able to add compose to my existing project for some time now because of kotlin reflect issues (that using moshi brings up) and some people recommended that I wait for 1.4.20 of kotlin. Since the 1.4.20 eap came out today I tried it. The app would crash at runtime due to a kotlin reflect issue with this
    composeOptions {
        kotlinCompilerVersion '1.4.10'
        kotlinCompilerExtensionVersion '1.0.0-alpha03'
    }
    but now I updated to
    composeOptions {
        kotlinCompilerVersion '1.4.20-M1'
        kotlinCompilerExtensionVersion '1.0.0-alpha03'
    }
    and the app won't even compile. stack trace attached. Is this a known issue by chance?
    Untitled
    a
    j
    • 3
    • 3
  • s

    sindrenm

    09/29/2020, 8:45 PM
    Is it intentional that
    FlowRow
    and
    FlowColumn
    don't have modifiers?
    v
    a
    k
    • 4
    • 5
  • a

    Archie

    09/30/2020, 8:09 AM
    Hi @nickbutcher, may I ask a question about theming in compose. I have a situation where my primary color shouldn't be used for components that by default uses the primary color. for example: my primay color is Red so when using TextField, its active color defaults to Red. But I don't want it red but instead I need its active color to be Blue. If I understand it correctly, I would just have to create my own TextField and replace the active color. But then I look into Composable functions that create TextField and there are two. I would then have to have my own version of these two TextField Composable function with the overriden active color to Blue. It was fine here since there are only two functions I have to modify, but I was thinking what if there was more than two of these function or maybe in the future there may be additional of these functions. Is this the correct way to approach this problem?
    n
    y
    c
    • 4
    • 10
  • a

    Archie

    09/30/2020, 1:14 PM
    Is there any way to make
    DropDownMenu
    work like
    TextInputLayout
    with
    Spinner
    ? Like so?
    y
    m
    m
    • 4
    • 19
  • p

    Prashant Priyadarshi

    09/30/2020, 2:15 PM
    I am trying to implement a chat screen , simillar to that of sample jetchat app. Problem is keyboard is overlapping parts of input text field and panel consisting of emoji, send button etc. Any idea why this is happening and how it can be corrected. I am attaching screen shots of both screen for mine code and original code
    j
    y
    a
    • 4
    • 4
  • m

    Mini

    09/30/2020, 6:09 PM
    I am trying to add Compose to an existing project, however i get this error:
    java.lang.AssertionError: Unbound symbols not allowed
    
    Execution failed for task ':app:compileOmbordsalgStagingDebugKotlin'.
    > Internal compiler error. See log for more details
    Runtime JAR files in the classpath should have the same version. These files were found in the classpath: And then a loooooong list of Unbound public symbol for public kotlinx.android.synthetic...... Anyone know how to fix this?
    r
    a
    +2
    • 5
    • 6
  • m

    Michal Harakal

    09/30/2020, 8:34 PM
    A noob question. All samples for jetpack compose I have seen, also official ones have still groovy build files. Is there a reason for that or it is just a coincidence? I am asking becuase having issues (maybe be not related to jetpack) during migration to 1.4.x and compose.
    j
    • 2
    • 2
  • g

    Guy Bieber

    09/30/2020, 8:56 PM
    The example of rotation in the jetpack compose playground seems a bit messy. Is there a simpler method to rotate a @Composable?
    v
    • 2
    • 14
  • g

    Guy Bieber

    09/30/2020, 10:01 PM
    I noticed the source code is no longer visible. I wanted to take the slider code and make a customized vertical slider. Is the source for compose still going to be available?
    z
    l
    • 3
    • 3
  • b

    bruno.aybar

    09/30/2020, 11:39 PM
    Hello! I've seen that in AS canary 12, the
    comp
    live template default value is:
    @androidx.compose.Composable
    fun $NAME$() {
    $END$
    }
    it should be
    androidx.compose.runtime.Composable
    , right?
    l
    • 2
    • 2
  • c

    Chethan

    10/01/2020, 4:16 AM
    Do we have Ratingbar in Compose ?
    a
    a
    v
    • 4
    • 3
  • j

    Johnathan Leung

    10/01/2020, 4:17 AM
    I am a noob to Android dev, but I understand the reactive UI pattern (from web dev). I have built a basic todo app with compose. But for ui, is it worth continuing to learn compose or should I wait for it to release and learn the current xml system for now?
    a
    r
    • 3
    • 3
  • b

    bruno.aybar

    10/01/2020, 4:34 AM
    Hello, I've had issues with alpha when updating from
    alpha02
    to
    alpha03
    .
    alpha02
    : animate alpha for a button, works fine
    alpha03
    : animate alpha for a button, main content animates correctly, but a weird border animation occurs I made an small sample:
    @Composable
    fun Alpha(modifier: Modifier) {
        val animation = animatedFloat(initVal = 1f)
        onActive {
            animation.animateTo(0f, anim = repeatable(
                iterations = Infinite,
                repeatMode = RepeatMode.Reverse,
                animation = tween(1000))
            )
        }
        Button(
            onClick = { ... },
            modifier = modifier.drawOpacity(animation.value)
        ) {
            Text("test")
        }
    }
    
    @Preview(showBackground = true)
    @Composable
    fun AlphaPreview() {
        Stack(Modifier.fillMaxSize()) {
            Alpha(Modifier.gravity(Alignment.Center))
        }
    }
    And this is how it looks if I use
    alpha03
    :
    alpha03.mov
    z
    k
    a
    • 4
    • 7
  • f

    fabio.carballo

    10/01/2020, 5:23 AM
    hey, is there any solution to define what was the
    textAllCaps
    when it comes to define the
    TextStyle/Typography
    ? I wanted one of my typography styles to always be in caps.
    z
    • 2
    • 2
  • m

    mattinger

    10/01/2020, 12:57 PM
    So, i’ve been building my own theme, and i’ve been wondering why Colors is treating the individual colors as mutable state, but typography doesn’t? I imagine maybe it’s helpful for the recomposer so that it doesn’t have to rebuild the full component tree if colors change, it can just adjust the color of the individual elements, but i’d like to confirm that.
    var primary by mutableStateOf(primary, structuralEqualityPolicy())
            internal set
    l
    • 2
    • 1
  • m

    mattinger

    10/01/2020, 12:58 PM
    It leads to a lot of extra code to create the update and updateColorsFrom functions, since everytime you add a new color, they have to be accounted for in both these functions.
    y
    • 2
    • 1
  • g

    Guy Bieber

    10/01/2020, 4:56 PM
    Weird problem. When I do this everything renders correctly (white text on background).
    Row (Modifier.weight(.5f)) {
       vehicleView()
    }
    However, when I do this the text disappears (though I see the main image):
    ScrollableRow(
       modifier = Modifier.weight(.5f),
       scrollState = scrollState
    ) {
       vehicleView()
    }
    Any thoughts?
    a
    z
    • 3
    • 4
Powered by Linen
Title
g

Guy Bieber

10/01/2020, 4:56 PM
Weird problem. When I do this everything renders correctly (white text on background).
Row (Modifier.weight(.5f)) {
   vehicleView()
}
However, when I do this the text disappears (though I see the main image):
ScrollableRow(
   modifier = Modifier.weight(.5f),
   scrollState = scrollState
) {
   vehicleView()
}
Any thoughts?
a

allan.conda

10/01/2020, 5:07 PM
how’s
= scrollState
defined?
z

Zach Klippenstein (he/him) [MOD]

10/01/2020, 5:08 PM
also what’s the parent composable?
g

Guy Bieber

10/01/2020, 6:00 PM
Parent is a Column.
val scrollState = rememberScrollState()
It scrolls fine. It just messes up the rendering of vehicleView.
View count: 1