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

    ste

    05/07/2021, 1:10 PM
    How can I properly convert a
    androidx.compose.ui.text.TextStyle
    to
    androidx.graphics.Typeface
    ? I'm currently doing:
    val fontResourceId = ((textStyle.fontFamily as FontListFontFamily).fonts[0] as ResourceFont).resId // a lot of doubts about this
    val typeface = ResourcesCompat.getFont(context, fontResourceId)
    I need to ellipsize text at start, but this isn't possible yet, so I just draw that on a
    Canvas
    . Code in thread
    • 1
    • 1
  • a

    andrew

    05/07/2021, 2:21 PM
    I'm looking to create something similar to Threads, the Instagram messenger as a transition/animation exercise alongside routing. I'm trying to figure out how to expand a new page from the position of a list item and transition it cleanly. It seems that a lot of the animation APIs are kind of high level. Is there a good way to get positional data of a list item and share it to choreograph a transition?
    i
    • 2
    • 11
  • r

    robnik

    05/07/2021, 2:30 PM
    Do I need to set up some kind of registry for
    rememberSaveable
    to work? I stopped using the standard `NavController`/`NavHost` and now it (and
    rememberLazyListState
    ) stopped working.
    a
    s
    • 3
    • 14
  • m

    MaxUt

    05/07/2021, 4:09 PM
    Hi there, is there a way to propagate a click event to a Composable with a z-index inferior to the current one ?
    • 1
    • 1
  • s

    Slackbot

    05/07/2021, 4:42 PM
    This message was deleted.
    c
    n
    • 3
    • 2
  • m

    Mjahangiry75

    05/07/2021, 6:26 PM
    how to collapse
    bottomsheet
    in compose when
    backpressed
    d
    c
    • 3
    • 3
  • f

    Francisco Noriega

    05/07/2021, 6:29 PM
    I was using a
    BottomDrawer
    but that gave me issues when the content was scrollable (swiping would actually show the drawer instead of scrolling my content), so I migrated to a
    BottomSheetScaffold
    , but I don't seem to find away to add a scrim/darkened layer when the bottom sheet is showing like
    BottomDrawer
    does. Is this not supported by
    BottomSheetScaffold
    ?
    a
    d
    • 3
    • 7
  • n

    Nthily

    05/07/2021, 7:30 PM
    Does anyone know why the bottom of the lazyColumn is incomplete?
    c
    a
    c
    • 4
    • 17
  • n

    nglauber

    05/07/2021, 7:36 PM
    I’m using the
    HorizontalPager
    from accompanist library. In version
    0.9.0
    the
    offscreenLimit
    parameter was removed, but it’s still in the docs… Is there any replacement for this param? cc: @cb
    c
    n
    +2
    • 5
    • 26
  • l

    Lilly

    05/07/2021, 7:54 PM
    I would like to preview my screen content which expects a view model/presenter (custom class) object. I have made interfaces for this but I'm a bit lost how to fake the presenter object or is the suggested way to instantiate the presenter object here directly (but which leads to a render problem)?
    @Preview
    @Composable
    private fun Preview() {
        MyTheme {
            DashboardContent(
                scaffoldState = rememberScaffoldState(),
                appBarTitle = "Preview",
                presenter = // TODO
            )
        }
    }
    f
    • 2
    • 6
  • s

    spencer

    05/07/2021, 7:57 PM
    Has anybody been able to use exoplayer to play video in a LazyColumn and scroll smoothly?
    c
    • 2
    • 2
  • r

    robnik

    05/07/2021, 10:11 PM
    How do you run things at the end of an animation? I'm probably thinking about this wrong, but I want to use
    Animatable
    to move a Float from 0 to 1.0 and then set some state to null at the end. I thought
    animateTo
    might have an
    onDone
    block, but no.
    t
    s
    • 3
    • 3
  • n

    Nat Strangerweather

    05/08/2021, 9:29 AM
    Hi, I have two questions about my code. 1. at the end, when I measure the x offset of my Tile, how do I reference the maxWidth of my parent Box? 2. how can I make sure that each Tile is dragged individually rather than as a group? 🧵
    e
    a
    • 3
    • 6
  • n

    Nthily

    05/08/2021, 12:36 PM
    Can anyone tell me how to use
    BackHandler
    ? I want to use it to collapse
    ModalBottomSheet
    , but I didn't find a good way to use it
    e
    p
    • 3
    • 11
  • z

    Zhelyazko Atanasov

    05/08/2021, 2:04 PM
    So far what's the general approach to placing a
    TopAppBar
    in a general case where every screen of an app has one. Do we create a single
    TopAppBar
    and mutate the title and menus via events or we'd rather have a
    TopAppBar
    defined in each screen? What bothers me in the second option is that if you animate the transition between screens, the
    TopAppBar
    will also be animated (I haven't looked into transition animations yet) unless we do something more custom for the app bar itself. And there are cases where the
    TopAppBar
    shouldn't be animated and only its title and/or menus should be updated when changing screens.
    a
    n
    c
    • 4
    • 6
  • y

    YASAN

    05/08/2021, 4:41 PM
    The first time I tap on my
    TextField
    its bottom is not fully visible but after that one time it works fine. Is this a bug or I am doing something wrong? [Gif in thread]
    ✅ 1
    d
    c
    • 3
    • 5
  • a

    Archie

    05/08/2021, 6:06 PM
    Hi, I was wondering what does it mean when you call
    subcompose(...)
    inside
    SubcomposeLayout(…)
    ? Is there a good source that dives deep into
    SubcomposeLayout
    ? Thanks in advance.
    👍 2
    z
    s
    • 3
    • 11
  • s

    stkent

    05/08/2021, 8:51 PM
    Looking to build some intuition around when props are specified as direct composable function parameters vs as modifiers. Is there a good rule of thumb to get started with?
    a
    • 2
    • 14
  • c

    Carson Holzheimer

    05/09/2021, 5:26 AM
    Would creating compose bindings for flutter (or some layer of the flutter stack) be a potential way to get compose-ui displaying on iOS? I know nothing about the internal work that would be required. Has something like this already been experimented with?
    r
    o
    c
    • 4
    • 8
  • a

    Ajay Venugopal

    05/09/2021, 12:09 PM
    HI , I have a list of items in lazy column view. How we can show animation when we are removing the one item from the list. I need to animate the view which is getting deleted. The delete operation is done by pressing the delete icon inside the view.
    s
    y
    +3
    • 6
    • 16
  • a

    andrew

    05/09/2021, 3:10 PM
    From a small portion of a composable to the initial clip rect of the composable?
    c
    d
    • 3
    • 5
  • v

    Vinay Gaba

    05/09/2021, 3:54 PM
    The latest edition of Code Magazine has Jetpack Compose on the cover 😄 Wasn’t expecting it to be the cover story when I first wrote that article but I’ll happily take it. You can find the digital edition here - https://www.codemag.com/Magazine/Issue/MayJun21.
    :party-parrot: 20
    🎉 5
    👍 1
    👏 4
    :kotlin-intensifies: 12
    👏🏽 1
    a
    • 2
    • 3
  • n

    Nat Strangerweather

    05/09/2021, 7:13 PM
    Hi, I'm still working on my custom layout and I have a question. The Layout modifier applies to the whole layout, unsurprisingly. If I wanted the modifier to apply to each of the placeables, how would I go about it? For instance, in the case of a
    draggable
    modifier, I don't really want the whole layout to be dragged, but only the individual elements of the layout. I have posted this on 😒tackoverflow:, if anyone wanted to have a look... https://stackoverflow.com/questions/67457124/how-to-apply-the-layout-modifier-to-each-placeable-individually-in-jetpack-compo . Thanks! 😊
    o
    d
    • 3
    • 12
  • n

    Ngenge Senior

    05/09/2021, 7:30 PM
    I do not know if anyone faces same problem like I. I am using coil for Image loading and I am using rememberCoilPainter and passing an Image url. Previewing or running on device shows nothing. I have even used the deprecated CoilImage and I still have the same issue
    s
    a
    • 3
    • 2
  • s

    Spikey Sanju

    05/09/2021, 10:40 PM
    Hello all, How to save
    Color
    to
    room db
    in Jetpack Compose?. I’m trying to save an Article to room db (One of the params is
    Compose Color
    ). Currently it shows error like to Use
    TypeConverter
    for
    color
    field to save the data. How to achieve this?. Below I’ve attached my Model class.
    s
    a
    • 3
    • 5
  • a

    AN

    05/10/2021, 3:26 AM
    Any suggestions on what is the best way to migrate a project to compose? The project is modularized by feature and uses single activity and navigation component to navigate between fragments via deep links. I know that I should keep the fragments as wrappers for composables until the whole app is fully migrated but from where should I start the migration process? The app uses bottom navigation which is being setup using the navigation component. How can I convert the bottom nav to a compose UI and set it up with the navigation component?
    i
    • 2
    • 2
  • n

    Nathan Castlehow

    05/10/2021, 5:42 AM
    Hi, does anybody know how to do styling + formatted arguments with text that is being shown in a text composable? The use case is to just bold two items in the string which are getting fed in with format strings. Options in thread.
    s
    s
    • 3
    • 4
  • a

    Anton Shilov

    05/10/2021, 9:57 AM
    Hey folks! Is there any particular reason why
    @Preview
    annotation has
    @Retention(AnnotationRetention.SOURCE)
    but not
    RUNTIME
    ? I'm trying to build a component gallery app, and would like to find all the Preview composables using reflection. Unfortunately I cannot do it right now without using codegen. Would it make sense for me to send a PR changing retention from
    SOURCE
    to
    RUNTIME
    ?
    e
    v
    +2
    • 5
    • 8
  • n

    Noé Casas

    05/10/2021, 11:25 AM
    Hi. Is it possible to use text alignments (i.e.
    textAlign = TextAlign.Center
    ) with
    ClickableText
    (see https://developer.android.com/jetpack/compose/text)? The
    ClickableText
    API seems not to support it. My goal is to have hyperlinks on some of the words, like this: https://stackoverflow.com/a/65656351/674487 , but I would like the text to be centered
    • 1
    • 1
  • a

    Ajay Venugopal

    05/10/2021, 11:41 AM
    HI, How can we add scrollbar to the lazy column ?
    n
    z
    +3
    • 6
    • 10
Powered by Linen
Title
a

Ajay Venugopal

05/10/2021, 11:41 AM
HI, How can we add scrollbar to the lazy column ?
n

nglauber

05/10/2021, 12:50 PM
If you mean, make the content scrollable, yes. If you want to see the scrollbar, I also want to know.
a

Ajay Venugopal

05/10/2021, 1:03 PM
Im looking for the scrollbar 🙂
🙌 1
👍 1
n

nglauber

05/10/2021, 2:15 PM
@jim do you folks have a plan of when the scrollbars will be supported? (I mentioned you because I saw an answer from you in January)
z

Zach Klippenstein (he/him) [MOD]

05/10/2021, 3:49 PM
Compose for desktop implements scroll bars, you could look at the code for that.
j

jim

05/10/2021, 3:55 PM
I think more unified scrollbar support is tentatively slated for some time this year, subject to change without notice, timelines difficult to anticipate, yada yada.
✔️ 1
a

Ajay Venugopal

05/14/2021, 6:37 PM
compose for desktop and android are different right ?
j

jim

05/14/2021, 7:55 PM
The Google-published binaries are Android-only. The Jetbrains-published artifacts are MPP-capable and can be used with both Desktop and Android. As an example, take a look at https://github.com/JetBrains/compose-jb/tree/master/examples/imageviewer
m

MaxUt

08/03/2021, 7:57 AM
@Ajay Venugopal Did you figure out a solution by any chance ?
a

Ajay Venugopal

08/03/2021, 7:59 AM
No @MaxUt.
c

Chris Miller

08/14/2021, 11:57 PM
This approach works: https://stackoverflow.com/questions/66341823/jetpack-compose-scrollbars
View count: 5