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

    Halil Ozercan

    07/15/2020, 4:56 PM
    I have a very noob question. What is the easiest way to definitely recompose a View? In other words, completely remove from the tree and reinsert like it's brand new.
    z
    t
    s
    • 4
    • 5
  • f

    Fudge

    07/15/2020, 8:43 PM
    I feel like I'm missing something, is there no way to align a child of a Column to the end of the column? The
    gravity
    modifier only allows aligning horizontally, but not vertically (and also can only be called when a Column is in scope which is very odd, I mean what do you do when the column is way up the tree?)
    n
    z
    a
    • 4
    • 19
  • i

    Ian Lake

    07/15/2020, 10:27 PM
    July 4th holiday meant a skipped cycle
    ☝️ 1
    z
    j
    m
    • 4
    • 4
  • m

    Madhava

    07/15/2020, 10:58 PM
    I have a weird one. I have a google map view inflated from an xml which is working perfectly when I first load this "screen". I am using zsoltk/compose-router to push the view onto the router stack and remove it. When the view loads everything is perfect. When I hit back and then load it again, the map is white. The same log message "Setup map" gets outputted so its running the inflate setup function.
    j
    • 2
    • 2
  • h

    henrikhorbovyi

    07/16/2020, 12:40 AM
    Someone to share a ConstraintLayout demo using
    dev14
    ?
    v
    • 2
    • 1
  • r

    romainguy

    07/16/2020, 12:42 AM
    https://github.com/romainguy/sample-materials-shop/blob/main/app/src/main/java/com/curiouscreature/compose/sample/shop/MainActivity.kt#L243
    ❤️ 4
    ✔️ 1
    h
    • 2
    • 1
  • s

    Slackbot

    07/16/2020, 1:50 AM
    This message was deleted.
    l
    • 2
    • 2
  • d

    Doris Liu

    07/16/2020, 2:09 AM
    Hello everyone, I work on Compose Animation. I would love to collect feature requests from you guys on layout animation in compose. 😀 The more specific the better! If you have run into the cases where layout changes happen so fast and instantaneously that you wish it would slow down and get smoothed over, this would be a perfect opportunity to bring it up! 😉
    🙏 5
    t
    f
    • 3
    • 4
  • m

    Madhava

    07/16/2020, 5:18 AM
    Got a possible issue which I can replicate in my app causing a crash, where i filter the items for LazyColumnItems from a search box and then bind them to the items with a state {}. Sometimes if you try to scroll when its empty it crashes the app:
    JNI DETECTED ERROR IN APPLICATION: JNI CallVoidMethodV called with pending exception java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 
    at java.lang.Object java.util.ArrayList.get(int) (ArrayList.java:437)
    
    held mutexes= "mutator lock"(shared held)
    I can share more detailed error logs if anyone wants.
    t
    a
    • 3
    • 3
  • a

    allan.conda

    07/16/2020, 7:06 AM
    Anyone know how can I access compose samples?
    t
    v
    • 3
    • 2
  • f

    Fudge

    07/16/2020, 12:15 PM
    How can I place a component under a
    LazyColumnItems
    ? I have no problem placing one above it, e.g.
    Column {
                Text("top")
                LazyColumnItems(items = listOf("1","2","3")) {
                    Text(it)
                }
            }
    But if I try to place it below the
    bottom
    text doesn't appear.
    Column {
                LazyColumnItems(items = listOf("1","2","3")) {
                    Text(it)
                }
                Text("bottom")
            }
    (In my case I also want to attach
    bottom
    to the bottom of the column so I would add
    fillMaxHeight().wrapContentHeight(Alignment.Bottom)
    as well)
    m
    t
    • 3
    • 12
  • f

    Fudge

    07/16/2020, 1:35 PM
    Is there some way to make a
    TextField
    unfocus? I can't draw focus away not by tapping outside, or by tapping the IME action on the keyboard, and I can't find a way to do it in code (something like a FocusNode I get from the
    TextField
    that I can call
    unfocus()
    on) I've found some outdated discussion about it: https://kotlinlang.slack.com/archives/CJLTWPH7S/p1584069025456900?thread_ts=1584053267.453300&cid=CJLTWPH7S
    👍 1
    s
    m
    r
    • 4
    • 5
  • c

    CodeIdeal

    07/16/2020, 3:45 PM
    Why my drawShadow‘s rendering is so poor?
    m
    a
    • 3
    • 3
  • c

    chris

    07/16/2020, 3:50 PM
    How do you know where to draw the line when building components? How was it decided to build a
    Box
    but to not create a
    Circle
    composable? I find myself wanting to break everything out into reusable components and rather than just creating the page I need, I end up building a whole infrastructure of components behind it.
    z
    t
    +4
    • 7
    • 33
  • c

    caelum19

    07/16/2020, 9:59 PM
    Hey, I am trying to have a popup similar to AlertDialog but bigger and with different content,
    Dialog
    seems good for this but it appears to have a rather small fixed size? Any pointers?
    t
    • 2
    • 2
  • m

    Madhava

    07/16/2020, 10:55 PM
    Is there a reason the bug tracker issue buttons are greyed out? I am logged in with my Google account in Chrome.
    • 1
    • 2
  • d

    Doris Liu

    07/17/2020, 2:07 AM
    ]
    😅 2
    😂 4
    👍 8
    🤔 1
    a
    • 2
    • 2
  • m

    Marcin Środa

    07/17/2020, 7:48 AM
    Hi! How can I translate xml constraint into compose?
    <?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="<http://schemas.android.com/apk/res/android>"
        xmlns:app="<http://schemas.android.com/apk/res-auto>"
        xmlns:tools="<http://schemas.android.com/tools>"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Text goes here and it is reeeeeeeeeeeeeeeally long "
            android:singleLine="true"
            android:ellipsize="end"
            app:layout_constrainedWidth="true"
            app:layout_constraintEnd_toStartOf="@id/image"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    
        <ImageView
            android:id="@+id/image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constrainedWidth="true"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toEndOf="@id/textView"
            app:layout_constraintTop_toTopOf="parent"
            tools:src="@tools:sample/avatars" />
    
    </androidx.constraintlayout.widget.ConstraintLayout>
    The idea is simple - don't let TextView to push ImageView out of screen. I've set a ConstraintSet but cannot found an equivalent of constrainedWidth. Any ideas?
    t
    g
    j
    • 4
    • 8
  • d

    Daniele Segato

    07/17/2020, 11:02 AM
    Is there a reason why Test tagging is not implemented with Modifier?
    z
    r
    • 3
    • 3
  • d

    Daniele Segato

    07/17/2020, 11:14 AM
    How do you handle lifecycle inside Compose?
    m
    • 2
    • 1
  • d

    Daniele Segato

    07/17/2020, 11:14 AM
    What about startActivityForResult / Permission Requests and all those stuff that was usually needed in an activity/fragment?
    m
    a
    • 3
    • 3
  • g

    galex

    07/17/2020, 2:03 PM
    Hello, where can I find the list of already developed material components for Compose?
    z
    • 2
    • 2
  • b

    Byron Roberts

    07/17/2020, 2:30 PM
    Hi guys. I'm trying to integrate Compose into a production project to test it's integration with our current pattern and can't seem to get it compiling correctly. I've updated the Gradle plugin to 6.5 and the AGP to 4.2.0-alpha3 and it seems all the plugins I have defined now don't work and I keep getting errors along the lines of
    Plugin with id 'findbugs' not found
    . I've tried removing them one by one but it eventually gets to Android plugins to which it claims to not be able to find. Just wondering if anyone ese has experienced this or if I might be missing something?
    t
    • 2
    • 1
  • g

    galex

    07/17/2020, 3:44 PM
    I have a Row I and in it I would like a Text() at its Start and another Text at its aligned to the end, how do I achieve that? Is there some documentation on alignments of that sort?
    a
    • 2
    • 5
  • m

    Marcin Środa

    07/17/2020, 5:01 PM
    Any idea how to deal with viewModel and Composable? Let's say I want to declare a state inside viewModel and changed it through InputText.
    class MessageViewModel : ViewModel() {
    
        var state: MutableState<TextFieldValue> = state { TextFieldValue() }
    }
    Cause: Functions which invoke @Composable functions must be marked with the @Composable annotation
    z
    s
    s
    • 4
    • 8
  • z

    Zach Klippenstein (he/him) [MOD]

    07/17/2020, 5:01 PM
    Saw the PR to add LazyItemsScope. It's a neat way to "magically" make those modifiers do what you'd intuitively expect them to do, but it seems like it would be really easy to accidentally factor out a composable and not realize that you're using the shadowed modifier and forget to add the scope to the factored composable.
    l
    m
    +2
    • 5
    • 13
  • g

    galex

    07/18/2020, 4:06 AM
    I’ve created a simple app with Navigation Component and a few fragments. Should I replace only the fragment views with Compose (which I am not sure how to do) or should I go all the way and replace everything with Compose and do something like the JetNews sample does, or is there any better example?
    i
    • 2
    • 3
  • g

    galex

    07/18/2020, 6:43 AM
    In a Composable function, I could not just call
    invoke()
    on a reference of another Composable function, will that work someday?
    m
    a
    • 3
    • 4
  • r

    romainguy

    07/18/2020, 7:01 AM
    Using
    Canvas.scale()
    j
    • 2
    • 6
  • y

    Yuriy Kulikov

    07/18/2020, 1:44 PM
    Hello everyone, can someone help me with a layout for a list row? I cannot wrap my head around it. I have a Row, which has 2 child Columns. First Column has a Text. The second Column has a Switch and a Text. The height of the Row should be defined by the height of the first column. I would like to make Switch and the Text in the second Column to have equal weights and to stretch. Can I achieve this with current state of Compose? Thank you.
    j
    • 2
    • 15
Powered by Linen
Title
y

Yuriy Kulikov

07/18/2020, 1:44 PM
Hello everyone, can someone help me with a layout for a list row? I cannot wrap my head around it. I have a Row, which has 2 child Columns. First Column has a Text. The second Column has a Switch and a Text. The height of the Row should be defined by the height of the first column. I would like to make Switch and the Text in the second Column to have equal weights and to stretch. Can I achieve this with current state of Compose? Thank you.
j

Jorge Castillo

07/18/2020, 1:49 PM
If you can send a draft or something it'd be easier to help 👍
y

Yuriy Kulikov

07/18/2020, 1:52 PM
Code or image?
@Jorge Castillo Is this is what you had in mind as draft? 🙂
j

Jorge Castillo

07/18/2020, 2:12 PM
Yeah thanks. I'll try something.
What about something like this?
https://gist.github.com/JorgeCastilloPrz/5f9ac0466afd923a83b6378e8d2f31ae
y

Yuriy Kulikov

07/18/2020, 2:26 PM
Awesome! Thank you!
I will take your solution as a basis and will work from there🙂
It worked well 🙂 Unfortunately, ConstraintSet is deprecated in dev14. Going to look into ConstraintLayoutDemo and DemoInlineDSL which are mentionen in dev14 KDoc.
j

Jorge Castillo

07/18/2020, 4:04 PM
Right. I didn't even look at what version I was using at that project. But I bet there are equivalents in dev14 if that's the case.
y

Yuriy Kulikov

07/18/2020, 4:07 PM
I ended up doing it this way:
modifier = Modifier
  .constrainAs(weekDaysText) {
    top.linkTo(timeText.bottom)
    start.linkTo(parent.start)
    end.linkTo(switch.start)
    bottom.linkTo(parent.bottom)
    width = Dimension.fillToConstraints
  }
constrainAs is available in ConstaintLayoutScope
j

Jorge Castillo

07/18/2020, 4:18 PM
Awesome
View count: 4