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

    joney

    11/06/2020, 3:26 PM
    Is it possible to define
    @Composable
    s in a kotlin multiplatform library-module and (re-)use those in android app-modules of the same project? I get these errors when building the project:
    Caused by: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call 'remember' into
    @androidx.compose.runtime.Composable public fun [...]
    t
    • 2
    • 2
  • d

    David Attias

    11/06/2020, 4:15 PM
    In the Compose tutorials, it is advised to use State in the ViewModel as much as possible because it makes the code simpler and it's right BUT is State lifecycle aware like LiveData ? Can we achieve the same ?
    h
    • 2
    • 2
  • n

    nrobi

    11/06/2020, 6:32 PM
    Having trouble using
    SwipeToRefresh()
    from JetNews with
    LazyColumnFor
    , more specifically doesn’t detect the swipe (just like I wouldn’t have the SwipeToRefresh component). I’m guessing it’s because the
    swipeable()
    setup conflicts somehow with the
    LazyColumnFor
    . Any ideas where should I look for?
    v
    a
    • 3
    • 4
  • n

    Nraghuramireddy

    11/06/2020, 7:55 PM
    Hey Folks, We are planning to develop a brand new Kotlin based Android project using Jetpack Compose and we are going to use bottom navigation view, drawer view, navigation components, co-ordinate layout kind of effects, paging 3.0 etc. I see that it is still in alpha and may release in 2021. We may release our app in Q2 2021, is it good idea to consider Jetpack Compose for development or we need to go with traditional layout based UI? Is Jetpack Compose supports all the components? Are there any apps in the playstore which are Jetpack Compose based? Any help will be much appreciated. Thanks.
    j
    d
    • 3
    • 6
  • l

    len

    11/06/2020, 9:17 PM
    Made this color picker today in just 200 lines (there could be less if I didn't need some color conversion utils). It can be updated with touch events or hex input
    👍 20
    🎉 4
    ❤️ 1
    a
    j
    • 3
    • 5
  • j

    Joost Klitsie

    11/06/2020, 9:18 PM
    Hi guys! On my android api 23 device I cannot put in capital characters. If I push the shift character, a
    \u0000
    is inserted and the keyboard switches right away to lowercase characters. Is there already a bug for this?
    j
    • 2
    • 2
  • v

    Vsevolod Ganin

    11/07/2020, 1:00 AM
    I think
    RadialGradient
    is not working properly as of alpha06. I want to draw a simple circle that have white color from center to
    0.5 * radius
    and then have a uniform blend from white to black from
    0.5 * radius
    to
    radius
    . What I did is
    Canvas(modifier = Modifier.fillMaxSize()) {
        drawCircle(
            brush = RadialGradient(
                0.0f to Color.White,
                0.5f to Color.White,
                1.0f to Color.Black,
                centerX = center.x,
                centerY = center.y,
                radius = size.width
            )
        )
    }
    This code displays the whole circle in white.
    n
    • 2
    • 5
  • l

    Luis Daivid

    11/07/2020, 5:00 AM
    I added bottomNavigation to scaffold. However, the bottom of the content of the scaffold is covered by the bottom navigation. What should I do?
    f
    j
    • 3
    • 6
  • k

    Kshitij Patil

    11/07/2020, 8:53 AM
    How to put compose preview in a landscape mode? I've set the
    widthDp
    accordingly with
    showDecoration=true
    but still the view looks like a portrait mode only
    • 1
    • 1
  • g

    gsala

    11/07/2020, 11:22 AM
    Using the new navigation for Compose, can I use
    Parcelable
    arguments or is it only uri-based arguments that can be parse to primitive types?
    g
    i
    j
    • 4
    • 8
  • k

    Kshitij Patil

    11/07/2020, 11:42 AM
    Looks like using custom vector drawables using
    vectorResource()
    messes up with the fill color of vector drawable based on the current theme (dark theme inverts the color). I tried using same vector drawable in a non-compose project and colors remained the same.
    n
    • 2
    • 3
  • k

    Kshitij Patil

    11/07/2020, 2:03 PM
    Is there any way I could preview colors (gutter) defined in .kt file?
    m
    a
    • 3
    • 4
  • z

    zoha131

    11/07/2020, 7:04 PM
    I am trying to introduce compose to an existing project. But I am getting this error:
    java.lang.NoSuchMethodError: No virtual method setContent(Lkotlin/jvm/functions/Function0;)V in class Landroidx/compose/ui/platform/ComposeView; or its super classes (declaration of 'androidx.compose.ui.platform.ComposeView' appears in /data/app/bd.com.qualityfoods.app-LVPKnecUB1gsJPhJDkqZfA==/base.apk)
            at com.conceptgang.app.page.home.HomeFragment.onCreateView(HomeFragment.kt:76)
            at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2898)
            at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:527)
            at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1324)
            at androidx.fragment.app.FragmentManager.addAddedFragments(FragmentManager.java:2392)
            at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2137)
            at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2061)
            at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1957)
            at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:496)
            at android.os.Handler.handleCallback(Handler.java:873)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:201)
            at android.app.ActivityThread.main(ActivityThread.java:6826)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
    • 1
    • 1
  • s

    Siyamed

    11/07/2020, 7:12 PM
    LocaleList.current
    l
    • 2
    • 1
  • a

    aperfilyev

    11/07/2020, 7:40 PM
    How do I save state inside
    LazyColumnFor
    ? Each
    requestItem
    is a network call that gets executed when I scroll back and forth.
    g
    • 2
    • 1
  • r

    redrield

    11/08/2020, 5:59 AM
    Is there a composable for a material toggle button in compose stdlibs? (ie mutually exclusive button group sharing a container)
    j
    • 2
    • 2
  • k

    Kshitij Patil

    11/08/2020, 6:44 AM
    Has anyone done any adventure project with
    BackdropScaffold
    ? I am trying to build a horizontal backdrop and was looking for some reference project
    n
    m
    • 3
    • 7
  • v

    Vivek Sharma

    11/08/2020, 10:35 AM
    Anyone tried BottomDrawerLayout with fab? I cant fix its height and the fab appears when bottomdrawerlayout opens , any project on github to show this usecase?
    s
    m
    • 3
    • 7
  • n

    nitrog42

    11/08/2020, 12:08 PM
    Hello, sorry if it has been asked before but with AS 4.2 canary 16, and latest compose version, IntelliJ doesn't find any kotlin specific methods (like listOf(), forEach{} ) even in non-composable function. The code still compile and works... Is there any fix/workaround ? I couldn't find an issue about that
    g
    • 2
    • 7
  • s

    SrSouza

    11/08/2020, 4:56 PM
    message has been deleted
    👀 1
    👍 1
    k
    • 2
    • 1
  • m

    Mehdi Haghgoo

    11/08/2020, 8:46 PM
    I am getting some weird error with the new Compose Navigation.
    NavHost(navController, startDestination = "home"){
            composable("new-item"){NewItem(navController)}
            composable("profile/{name}", listOf(navArgument("name"){type = NavType.StringType}))
            {navBackStackEntry ->
                Profile(navBackStackEntry.arguments?.getString("name").toString())
            }
    
            composable("home?costName={costName}&costValue={costValue}",
                    arguments = listOf(navArgument("costName"){nullable = true}, navArgument("costValue"){type = NavType.IntType; defaultValue = 0})){
                navBackStackEntry ->  Home(navController, navBackStackEntry.arguments?.getString("costName"), navBackStackEntry.arguments?.getInt("costValue"))
            }
        }
    
    //    java.lang.IllegalArgumentException: navigation destination 150924488 is not a direct child of this NavGraph
    //    at androidx.navigation.NavGraphNavigator.navigate(NavGraphNavigator.java:66)
    i
    • 2
    • 11
  • c

    Chethan

    11/09/2020, 9:51 AM
    How can I start the text field to middle of screen ? This is not starting Text from the center
    Column(
        modifier = Modifier.padding(start = 10.dp)
    ) {
    
        Spacer(modifier = Modifier.fillMaxHeight(0.5F).fillMaxWidth())
        Text(
            text = "Provider name",
            style = TextStyle(
                color = Color.White,
                fontSize = 14.sp,
                fontWeight = FontWeight.Bold,
                textAlign = TextAlign.Center
            )
        )
    
        Text(
            text = "Provider Address",
            style = TextStyle(
                color = Color.White,
                fontSize = 11.sp,
                textAlign = TextAlign.Center
            )
        )
    
        // setRatingBar()
    }
    I want to start “Provider name” from vertical center
    v
    • 2
    • 6
  • h

    harry248

    11/09/2020, 9:55 AM
    I would like to mimic the liftOnScroll capability of AppBarLayout and therefore have to observe the scroll offset of a LazyColumn. Unfortunately I can’t find a way to do so. Is this something missing at the moment?
    s
    • 2
    • 2
  • v

    Vivek Sharma

    11/09/2020, 10:26 AM
    Is there a difference between BottomSheetScaffold and BottomDrawerLayout? I tried both of them and found BottomSheet doesnt overshadow or come above the content on the screen behind it , Any idea🤔
    g
    • 2
    • 2
  • a

    alorma

    11/09/2020, 11:27 AM
    Hi Guys! I want to ask what is the best way to do something... I want to create a Composable ("view") to do a TimeLine (for example), and this will contains an icon, color and content for each "row" But, what I'm not sure is... if each row has a title, what's the best way? make a composable function with lambda that returns a String? What about icon? A lambda that returns an Asset? Or instead, a composable lambda to allow user to customize the title / icon... so it will allow change the size of the icon etc... TL;DR: What I'm not sure in compose is... how I allow customization of content with some constrained rules about style / size etc...
    s
    z
    v
    • 4
    • 11
  • s

    Stefano Rodriguez

    11/09/2020, 11:30 AM
    I’m noticing that if I apply a scale transformation on a container
    Box
    (with
    .drawLayer
    modifier) the input events are not properly transformed and looks like the button events are triggered by touch events on their original (not transformed) position. Is this something expected or a bug?
    m
    • 2
    • 4
  • m

    Marco Gomiero

    11/09/2020, 11:54 AM
    Hi everyone! I’m using the new navigation with a bottom navigation bar. I was trying to hide the bottom navigation when I’m showing a detail screen but when I try to navigate to the detail there is glitch. The detail screen is showed for less than a second and then the starting screen is show (it seems that there is a recomposition to the initial state). Did I miss something? Here’s the code to reproduce the issue: https://github.com/prof18/ComposeNavigationTest/blob/master/app/src/main/java/com/prof18/composenavigationsample/MainActivity.kt
    Screen Recording 2020-11-09 at 12.44.13.mov
    i
    • 2
    • 2
  • l

    Luis Daivid

    11/09/2020, 1:02 PM
    Please recommend an image loader. Which image loader do you use?
    v
    s
    g
    • 4
    • 4
  • j

    József Szilvási

    11/09/2020, 2:17 PM
    Hey, I have
    ModalBottomSheetLayout
    which contains a
    TextInput
    , and when it gets focus the keyboard appears above the sheet (z-index style) -> the sheet doesn't slide up to the top of the keyboard. Is there any way to fix this?
    s
    • 2
    • 2
  • t

    Tony Mykhaylovsky

    11/09/2020, 2:41 PM
    Hi everyone - I'm starting to work an a test project to get more comfortable with Android kotlin and Jetpack Compose. I am starting to learn how to use jetpack compose using this resource: https://github.com/vinaygaba/Learn-Jetpack-Compose-By-Example. Is this a good starting point? Recommend any courses that may give me a good foundation. Thank you!
    g
    • 2
    • 7
Powered by Linen
Title
t

Tony Mykhaylovsky

11/09/2020, 2:41 PM
Hi everyone - I'm starting to work an a test project to get more comfortable with Android kotlin and Jetpack Compose. I am starting to learn how to use jetpack compose using this resource: https://github.com/vinaygaba/Learn-Jetpack-Compose-By-Example. Is this a good starting point? Recommend any courses that may give me a good foundation. Thank you!
g

Gabriel

11/09/2020, 2:45 PM
https://developer.android.com/courses/pathways/compose
➕ 1
https://developer.android.com/jetpack/compose/tutorial
t

Tony Mykhaylovsky

11/09/2020, 2:49 PM
@Gabriel thank you, I will check these out. ++
How do I ++ rep?
g

Gabriel

11/09/2020, 2:49 PM
There's no rep in slack :)
t

Tony Mykhaylovsky

11/09/2020, 2:50 PM
Got it - thanks!
@Gabriel I click Play on an Android project I downloaded, it finished building, but never ran the simulator. Any ideas?
View count: 2