https://kotlinlang.org logo
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
  • b

    bohregard

    08/07/2020, 1:48 PM
    Is there any known issues with running compose on a Samsung tablet? I’m noticing I get AARs every time I launch the application, but only on my Samsung tablet. Emulators and some other devices I have don’t have this issue.
    j
    • 2
    • 3
  • c

    caelum19

    08/07/2020, 2:51 PM
    Hey, I've found that there is pretty low fps scrolling in a ScrollableColumn inside a ConstraintLayout with height set to Dimension.fillToConstraints, that contains text. No lag:
    setContent {
        ConstraintLayout(modifier = Modifier.fillMaxSize()) {
            val d = createRef()
    
            ScrollableColumn(modifier = Modifier.constrainAs(d) {
                top.linkTo(<http://parent.top|parent.top>, 30.dp)
                bottom.linkTo(parent.bottom, 30.dp)
                width = Dimension.value(360.0.dp)
                height = Dimension.fillToConstraints
            }) {
                for (i in 0..30) {
                    Box(
                        Modifier.size(135.dp, 60.dp).background(Color.Red)
                            .drawBorder(1.dp, Color.Black)
                    ) {
                        //  Text("scrrt scrrt")
                        for (i2 in 0..40 step 2)
                            Box(
                                Modifier.size((135 - i2).dp, (60 - i2).dp).background(Color.Red)
                                    .drawBorder(1.dp, Color.Black)
                            ) {
    
                            }
                    }
                }
            }
        }
    }
    Uncomment // Text("scrrt scrrt") and scrolling is pretty stuttery (even without the many cascading boxes) But with text, and height = Dimension.value(600.dp), the lag is gone. Without the ConstraintLayout there is also no lag. Am I doing something silly? I'll create an issue if I'm not 🙂 Using dev 16, though was equally an issue in 15 that I've just potentially isolated
    a
    • 2
    • 3
  • j

    John O'Reilly

    08/07/2020, 4:38 PM
    sorry if this has been covered before but .....am using
    Scaffold
    and the
    LazyColumnFor
    looks to be overlapping with
    BottomAppBar
    ...is there some modifier etc I should be using in this case (will add more code in thread)....
    m
    j
    m
    • 4
    • 10
  • j

    Ji Hwan Min

    08/07/2020, 7:10 PM
    How would I implement this feature in question in this post without using Views?: https://stackoverflow.com/questions/2302867/android-how-to-determine-character-index-of-a-touch-events-position-in-textvie
    z
    • 2
    • 1
  • g

    galex

    08/07/2020, 8:27 PM
    In terms of performance, is ConstraintLayout() more "expensive" than layouting with other Composables, like in the old UI toolkit?
    r
    z
    r
    • 4
    • 6
  • g

    galex

    08/08/2020, 8:28 AM
    What is the equivalent in Compose of
    adjustPan
    so that the keyboard does not hide an
    OutlinedTextField
    ?
    v
    • 2
    • 1
  • g

    galex

    08/08/2020, 12:27 PM
    Is there an equivalent to
    View.setVisibility
    on Composables? I’d like to hide a Composable when needed but not just change its opacity because this means it still catches onClicks!
    r
    a
    +3
    • 6
    • 10
  • g

    galex

    08/08/2020, 12:56 PM
    How can I close the software keyboard in onClick on a button? I can see we get
    softwareKeyboardController
    in
    onImeActionPerformed
    but what about other places? I didn’t find an Ambient for this
    f
    • 2
    • 10
  • c

    caelum19

    08/08/2020, 4:30 PM
    I have this issue where after interacting with TextFields, future touches have an offset. Anyone else experienced something similar ?
    a
    z
    • 3
    • 12
  • d

    Daniele B

    08/08/2020, 6:32 PM
    Is there a Table component in Jetpack Compose?
    z
    • 2
    • 10
  • k

    Karthikeyan1241997

    08/09/2020, 7:35 AM
    I am going to start learning Jetpack compose. But the library is still in developer preview. Is it the right time to start learning or can i just wait for upto some pre-release builds. Because i heard that there are some major API changes happening. Feel free to mention your suggestions guys. Thanks
    👍🏾 2
    h
    c
    a
    • 4
    • 3
  • m

    Meddy

    08/09/2020, 12:34 PM
    I too will like to start learning Jetpack compose. Any suggestions on good starting points in order to get started with the library. I know it is in developer preview and it's difficult to find starting points that are up to date
    c
    • 2
    • 2
  • m

    Mehdi Haghgoo

    08/09/2020, 5:24 PM
    Hi. On Canary 4.2 Alpha 07 I have an annoying error:
    Failed to resolve: org.jetbrains.kotlin:kotlin-stdlib:1.4-M3
    I don't have any usage of 1.4-M3 in my gradle files. My kotlin version in project level gradle file is 1.3.70. This is almost a new project and I haven't made many changes.
    a
    j
    • 3
    • 4
  • j

    John O'Reilly

    08/09/2020, 6:13 PM
    In following I have
    scaffold
    with
    bodyContent
    containing a list (using
    LazyColumnFor
    ) and a
    BottomAppBar
    ....selecting different options in bottom bar causes some state to change and for UI to be recomposed (with content of list updated).....the only issue is that list position remains the same. Is there way I can/should reset that when I select different option? https://github.com/joreilly/BikeShare/blob/master/app/src/main/java/com/surrus/bikeshare/MainActivity.kt
    b
    a
    • 3
    • 5
  • m

    Mehdi Haghgoo

    08/10/2020, 3:36 AM
    What does this mean "Class 'androidx.compose.ui.Modifier' is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler"? I am already using the latest kotlin compiler 1.4.0-rc. I don't understand.
    j
    • 2
    • 2
  • m

    Mehdi Haghgoo

    08/10/2020, 3:45 AM
    What's the difference between LazyColumnFor and AdapterList?
    v
    q
    b
    • 4
    • 6
  • b

    Brett Best

    08/10/2020, 3:46 AM
    @John O'Reilly interesting that you got kotlinx.serialization to work with Jetpack Compose
    f
    • 2
    • 1
  • b

    brandonmcansh

    08/11/2020, 12:06 AM
    running into weird UI issue with bottomdrawerlayout - i'm seeing this weird surface color persisting behind my content for the drawerContent that I can't mask or get rid of. As you can see from the top left and right next to my rounded corners is the background surface of the root composable
    • 1
    • 5
  • j

    Joost Klitsie

    08/11/2020, 7:56 AM
    Hi all! Is there a possibility to get a segment for a path? With the old android paths there is a method getSegment which gets a segment from a path. In the "old" world I could fetch the material background drawable, get the path of the outline and animate a segment along that path. In this way I can basically animate the outline of any given shape. I want to achieve the effect of the button in this video:
    button_animated_outline.mp4
    ❤️ 1
    • 1
    • 3
  • m

    Marcin Środa

    08/11/2020, 8:17 AM
    Do you expect to accept viewmodels in preview? Or is it disabled by design? I’m trying to create some kind of components which depends on states - in old approach I’ll use viewModel to handle lifecycle (like binding to service etc) and reuse some state. In compose I tried to pass viewModel as a parameter to composable - but I cannot use
    @Preview
    now. Any ideas how to achive it? My goal is to create a standalone component based on custom library / framework with defined fetching messages or something 🙂
    j
    f
    • 3
    • 3
  • k

    KamilH

    08/11/2020, 8:41 AM
    Does anyone else sees the following problem in `0.1.0-dev16`:
    Class 'androidx.compose.runtime.Composable' is compiled by a new Kotlin compiler backend and cannot be loaded by the old compiler
    I can see this even though app is compiling and running on my device
    a
    j
    z
    • 4
    • 7
  • m

    Marcin Środa

    08/11/2020, 9:16 AM
    Any updated examples with ConstraintLayout? After update to v16 cannot resolve `tag`:
    ConstraintSet {
       val image = tag(HEADER_MESSAGE_IMAGE_TAG)
       ...
    }
    Was looking for some similar id like
    layoutId
    but cannot see anything
    a
    v
    • 3
    • 7
  • p

    Philip Blandford

    08/11/2020, 10:17 AM
    If I try to specify the width of a TextField, it sets the editable section to that width, but centres it in a fixed-width container. Is this expected behaviour? It's certainly not what I expected...
    Column {
      TextField(value = "", onValueChange = { }, label = {}, modifier = Modifier.width(50.dp))
      TextField(value = "", onValueChange = { }, label = {}, modifier = Modifier.width(100.dp))
      TextField(value = "", onValueChange = { }, label = {}, modifier = Modifier.width(150.dp))
    
    }
    z
    v
    • 3
    • 2
  • p

    Paolo Achdjian

    08/11/2020, 11:00 AM
    If I want to use dev16 and so I have to use compiler version 1.4.0-rc, how I can use the preview if until Canary 8 ?
    t
    v
    • 3
    • 5
  • z

    Zach Klippenstein (he/him) [MOD]

    08/11/2020, 6:45 PM
    https://twitter.com/chrisbanes/status/1293200464734019584?s=21
    😀 3
    🤩 5
    😍 18
    👏 11
    👍 4
    🎉 5
    a
    c
    +5
    • 8
    • 16
  • z

    Zach Klippenstein (he/him) [MOD]

    08/11/2020, 6:57 PM
    There isn’t a Composable yet for a Checkbox that includes a correctly-positioned text label, is there?
    Checkbox
    requires an
    onCheckChanged
    function, which is unfortunate if you want to make the label clickable as well, since now you’re passing the same handler twice, and the checkbox itself is still clickable but with its own ripple.
    c
    d
    • 3
    • 3
  • l

    lib

    08/12/2020, 6:02 AM
    where is “darkColorPalette” in 0.1.0-dev16
    t
    • 2
    • 2
  • t

    tmphey

    08/12/2020, 8:26 AM
    Hey folks! Is there a place where I can read about compose compiler and runtime besides the source code itself? I wanna start hacking with it a bit 🙂
    👀 1
    • 1
    • 1
  • w

    Wajahat Karim

    08/12/2020, 9:04 AM
    Hey folks! I am trying to draw a
    VectorDrawable
    in the Canvas. I can only see methods like
    drawLine
    ,
    drawCircle
    or
    drawImage
    etc, but there's no method for either bitmap drawing (like I get bitmap from VectorDrawable) or directly for
    VectorAsset
    . I did tried it using the the vector path in form of string like in this example (https://github.com/JorgeCastilloPrz/ComposeFillableLoaders) from @Jorge Castillo . But, I am not able to fill color inside the path with this method. I want to fill the whole drawable from inside. Can anyone tell me how can I do this?
    j
    n
    • 3
    • 3
  • p

    Philip Blandford

    08/12/2020, 9:26 AM
    Is there a way to show a keyboard without it being requested by a textfield? Basically I want text to appear on a canvas as the user types.
    z
    • 2
    • 1
Powered by Linen
Title
p

Philip Blandford

08/12/2020, 9:26 AM
Is there a way to show a keyboard without it being requested by a textfield? Basically I want text to appear on a canvas as the user types.
z

Zach Klippenstein (he/him) [MOD]

08/12/2020, 1:36 PM
Sounds like your trying to implement TextField from scratch? That's really complicated, but you can just dig into the TextField source to see how it works. I don't think it's using any private APIs (Compose is just a library after all).
View count: 3