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
  • j

    John

    11/09/2020, 3:03 PM
    Is there a channel for non-android compose discussion?
    n
    a
    • 3
    • 3
  • h

    harry248

    11/09/2020, 3:58 PM
    Anyone experiencing a
    java.lang.IllegalArgumentException: Layer is redrawn for LayoutNode in state NeedsRelayout
    when using
    AnimatedVisibility
    for items in a LazyColumn?
    z
    a
    • 3
    • 5
  • p

    pavi2410

    11/09/2020, 5:36 PM
    How do I draw the icon as is, in the top app bar's title? I tried using navigationIcon, changed content color, emphasis to no avail
    ✔️ 1
    n
    • 2
    • 7
  • g

    grandstaish

    11/09/2020, 6:22 PM
    how do you consume scroll events on the way down the composable hierarchy? If I add a
    scrollable
    modifier a parent composable, I never get the opportunity to consume scroll events before my children do. Basically i want to intercept the scroll gesture
    ✅ 1
    j
    a
    +3
    • 6
    • 21
  • g

    Gabriel

    11/09/2020, 8:42 PM
    What's the best way to pass modifier to the sub children of a composable? I'm passing
    modifier: Modifier = Modifier
    from the parent to the child but, want to allow some control (background colour for eg) of the subchildren
    n
    z
    • 3
    • 9
  • s

    Sam

    11/09/2020, 11:51 PM
    we just migrated from
    zsoltk/compose-router
    to
    navigation-compose
    and a few issues rose to the forefront: • when where there be support for animation transitions between screens? • is there anyway to create a nested graph? • has anyone noticed sluggish performance when navigating? tapping a
    BottomNavigationItem
    used to have a clean ripple effect when navigating, and now it's super choppy (even without any screen to screen transition)
    i
    • 2
    • 8
  • t

    takahirom

    11/10/2020, 1:26 AM
    I have a question about Stateless composables. https://developer.android.com/jetpack/compose/state#stateless-composables Suppose you have a tab under HomeScreen and a list under it. HomeScreen → Article Tab → Favorite Tab → About Tab ... If you make HomeScreen Stateless, you will need to take a lot of arguments. What do you think should be done in such a case? Is it better not to make Composable like HomeScreen Stateless?
    /*
     * stateless
     */
    fun HomeScreen(val currentTab, val articleList...., onFavorite:()->Unit) {
    }
    j
    w
    • 3
    • 7
  • i

    Irving

    11/10/2020, 2:17 AM
    Hi,folks! If I want to know how the Composable function becomes the ui node and then the ui tree is formed, and how the modifier ultimately affects our Composable functions?Can I know by reading the source code of
    Composer
    or
    LayoutNode
    ? Or what source code do I need to read to get these knowledges? I am very confused and I want to know the principle behind the implementation.
    j
    • 2
    • 10
  • b

    Ben Woodworth

    11/10/2020, 2:29 AM
    Is there a reason that modifiers use a fluent interface instead of a DSL? It seems non-idiomatic for Kotlin, so I'm curious what the design decisions were, or what advantages this approach has 🙂
    g
    r
    j
    • 4
    • 17
  • s

    Siyamed

    11/10/2020, 4:18 AM
    Sounds like a bug
    a
    • 2
    • 3
  • g

    Geert

    11/10/2020, 10:35 AM
    I was changing the color of a Text, but what is the difference between both color values?? It can be set by the Text, but also by TextStyle???
    Text(
                    color = Color.White,
                    text = "Verwijder Alles",
                    textAlign = TextAlign.Center,
                    modifier = Modifier.padding(16.dp),
                    style = TextStyle(
                        color = Color.White,
                        fontSize = TextUnit.Sp(20),
                        fontWeight = FontWeight.Bold
                    ),
                )
    n
    a
    • 3
    • 3
  • g

    Gabriel

    11/10/2020, 10:53 AM
    Should the preview pane in AS show animations? It's just the
    CircularProgressIndicator()
    atm
    d
    • 2
    • 3
  • j

    Jrichards1408

    11/10/2020, 11:29 AM
    Hi. how do i use jetpack composes setContent {} inside a fragment?
    ✅ 1
    a
    f
    +2
    • 5
    • 6
  • c

    Cyril Find

    11/10/2020, 12:00 PM
    Hi, I'm trying to create a video clips feed with a LazyColumn and Exoplayer views in each cell but the scrolling is very slow and I can't find a way to play only one video at a time (basically i'm doing JetInstagram Reels but not fullscreen: https://github.com/vipulasri/JetInstagram/blob/master/app/src/main/java/com/vipulasri/jetinstagram/ui/components/VideoPlayer.kt) Has anyone tried this ? Do you have ideas how to improve it ?
    h
    • 2
    • 4
  • l

    Luis Daivid

    11/10/2020, 1:35 PM
    What’s the best way to implement a view like grid recycler view? Any good examples?
    c
    j
    • 3
    • 5
  • b

    Bradleycorn

    11/10/2020, 2:01 PM
    I’m excited for the new
    navigation-compose
    library. But, the examples in the documentation all show the
    navController
    being passed down into the “Screen” Composables, and click handlers setup that call
    navController.navigate()
    . Without having tried it yet myself, this seems not great. Writing a Composable that requires a
    navController
    makes it less testable and less re-usable, no? Seems like it might be better to let the composables bubble up events and then handle them and do the navigation at the root level of the tree where the navController exists. But that too can get complicated because a “nav event” might need more than just a route to navigate to (for example, you might want to specify if it should pop the back stack, and how far to pop the back-stack, etc).
    i
    • 2
    • 2
  • s

    Se7eN

    11/10/2020, 3:19 PM
    Is there something like weight sum for Row or Column?
    g
    a
    • 3
    • 15
  • k

    KamilH

    11/10/2020, 6:23 PM
    How is the “Composer” object passed to
    Composable
    functions? I went through “Under the hood of Jetpack Compose” recently and I saw it mentions that calling context is getting passed to
    Composable
    functions. I thought it’s done similarly to
    suspend
    functions, so when I decompile
    Composable
    function I will see something similar to
    Continuation
    object, but nothing like that is there. I know Compose works also in the phase of code generation during compilation, so is it possible to see generated code?
    r
    • 2
    • 1
  • b

    Big Chungus

    11/10/2020, 6:24 PM
    For the love of god, I can't find anything on the web that's tell me how to build a simple dropdown menu with compose? Do you guys have any suggestions for that?
    c
    • 2
    • 6
  • j

    Jordi Saumell

    11/10/2020, 8:08 PM
    Why is the body content in scaffold drawn behind the bottom bar? And what do you do to keep the content from being covered?
    j
    • 2
    • 3
  • e

    Eric Ampire [MOD]

    11/10/2020, 8:17 PM
    Hello, I’m trying to migrate to jetpack compose alpha-04 and when I try to compile I get this error
    java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/compose/ui/platform/InspectableParameter;
            at androidx.compose.foundation.BackgroundKt.background-1xq40Q0(Unknown Source:0)
    f
    • 2
    • 2
  • r

    Robert Menke

    11/11/2020, 12:18 AM
    Is there a compose compatible image picker library out there? Something like this that doesn’t depend on an activity? https://github.com/esafirm/android-image-picker
    i
    g
    • 3
    • 10
  • a

    Allan Wang

    11/11/2020, 8:58 AM
    Just started checking out compose again. Are fabs by default not supposed to have ripples? Do we need to provide modifiers ourselves? The examples output has it just dim on press
    j
    • 2
    • 1
  • r

    Rafs

    11/11/2020, 3:51 PM
    Hello Everyone, I'm trying to apply a
    snapShot
    on button click but I keep running into a
    snapshotApplyConflictException
    z
    s
    k
    • 4
    • 10
  • k

    Kshitij Patil

    11/11/2020, 4:17 PM
    What's the workaround for the magical behaviour of Box inside a Row as mentioned in the source of BottomNavigationItem I'm almost done with the integration of Backdrop with Navigation rail and I want to arrange all the navigation items at the top. Currently the Navigation rail is comprised of Custom Layout in a Box in a Column where each box is one Navigation item.
    l
    m
    • 3
    • 27
  • r

    Rafs

    11/11/2020, 4:34 PM
    How do you rotate an
    Image
    in compose?
    s
    • 2
    • 5
  • t

    tcracknell

    11/11/2020, 6:06 PM
    Hello! The latest Jetpack Compose minor release, alpha07, is here! You can get it now from Google’s Maven Repository. Release notes are available at https://developer.android.com/jetpack/androidx/versions/all-channel. As always, feedback is welcome; please log issues at https://issuetracker.google.com/issues/new?component=612128. Please note that we will not have a release in 2 weeks due to the American Thanksgiving holiday but will have a release 1 week later.
    😱 5
    :kotlin-intensifies: 2
    🙌 9
    🎉 43
    :party-parrot: 10
    a
    i
    +3
    • 6
    • 10
  • e

    Eric Ampire [MOD]

    11/11/2020, 7:34 PM
    Apparently it’s now possible to compile a jetpack compose project in version 4.1.1 of android studio without being enforced to use Android Studio 4.2
    👀 1
    😎 2
    j
    i
    d
    • 4
    • 5
  • j

    jaqxues

    11/11/2020, 7:51 PM
    After updating to Alpha07:
    java.lang.IllegalArgumentException: Invalid slot table detected
    👀 1
    j
    j
    +3
    • 6
    • 32
  • r

    Rafs

    11/11/2020, 9:21 PM
    How can I create an
    ImageAsset
    from a
    Bitmap
    object?
    i
    n
    c
    • 4
    • 11
Powered by Linen
Title
r

Rafs

11/11/2020, 9:21 PM
How can I create an
ImageAsset
from a
Bitmap
object?
i

Ian Lake

11/11/2020, 10:35 PM
Sounds like you're looking for `bitmap.asImageAsset()`: https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/package-summary#asimageasset
✅ 1
r

Rafs

11/11/2020, 10:52 PM
Thank you
@Ian Lake is there also a way of converting a
VectorAsset
created with
vectorResource(..)
into an
ImageAsset
?
i

Ian Lake

11/12/2020, 12:22 AM
Generally those aren't interchangeable things so the previous guidance has been that any API that takes an
ImageAsset
should have another overload that takes a
VectorAsset
(that's how
Icon
works for instance). I know there's been some recent work in this space - maybe @Nader Jawad has more info?
r

Rafs

11/12/2020, 12:24 AM
@Ian Lake I've been trying to draw a vector asset onto the canvas using
drawImage
but it's only accepting an
ImageAsset
and not a
VectorAsset
n

Nader Jawad

11/12/2020, 12:32 AM
You can draw a VectorAsset by creating a VectorPainter from it and calling draw into a target canvas
Icon and Image already have convience methods to consume VectorAsset instances directly and create a VectorPainter on your behalf
You can create a VectorPainter by calling
rememberVectorPainter(myVectorAsset)
within a composable method
There's some samples here: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-master-dev:compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/VectorGraphicsDemo.kt;l=45?q=VectorGraphicsDemo&sq=
r

Rafs

11/12/2020, 12:40 AM
Thank you @Nader Jawad
c

cb

11/12/2020, 7:31 AM
@Manuel Vivo and I went through recently in this talk (about 18:00) https://chris.banes.dev/talks/2020/compose-for-existing-apps-dcemea/
View count: 2