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
anko
  • a

    antonioleiva

    05/31/2017, 4:46 PM
    with Anko 0.10.1 (which was just released), the
    cancel()
    operation returns true, but it's still leaking the activity 😞
    b
    • 2
    • 3
  • s

    sitexa

    06/05/2017, 1:43 AM
    what’s the difference between anko-sdk17,… anko-sdk25? which one to use? any articles to read?
    m
    • 2
    • 1
  • b

    blakelee

    06/13/2017, 7:13 PM
    I'm trying to start an activity in my UI by passing in the type. However, I'm getting this error and I'm not sure what it means.
    Cannot use 'ACT' as reified type parameter. Use a class instead.
    code:
    class myClass<ACT: Activity>(): AnkoComponent<Fragment> ....
        ....
        floatingActionButton
        ....
        .setOnClickListener {
            startActivity<ACT>()
        }
    d
    • 2
    • 3
  • c

    classified.dev

    07/04/2017, 4:43 AM
    Hello fellow Kotlinauts. Can someone point me in the direction of an example of using Anko to drive a textWatcher where the text input is being referenced through the Kotlin extensions? I’ve been trying to find one on the web, but have yet to be successful. Thanks.
    a
    • 2
    • 9
  • n

    nickk

    07/14/2017, 8:19 AM
    Hi. What is the suggested way to include a fragment in an anko layout? There is no
    fragment
    function in the DSL.
    m
    • 2
    • 4
  • s

    spragg

    07/20/2017, 1:55 AM
    Hi, has anyone had any issue with findViewById() with imageView ?
    🤔 2
    n
    • 2
    • 3
  • m

    mkojadinovic

    07/25/2017, 9:21 AM
    Hi guys, do you know how to use properly cardView. I am trying something like this:
    cardView(){
        lparams(height = wrapContent, width = matchParent){
    
        }
    }
    And it looks like there is no lparams here. But if I do something like
    verticalLayout(){
        cardView(){
            lparams(height = wrapContent, width = matchParent){
    
            }
        }
    
    }
    it is there. So it looks like I can’t use cardView like root view?
    m
    b
    • 3
    • 5
  • d

    david.bilik

    07/28/2017, 11:33 AM
    relativeLayout {
       textView {
          text = "Hello world"
       }.lparams {
            alignParentTop()
       }
    }
    👍 1
    m
    a
    • 3
    • 2
  • a

    anthaugh

    07/28/2017, 1:19 PM
    What are your favourite ways to generate validable forms with anko? I'm struggling with choosing the best approach. Libraries would be best ^^
    m
    • 2
    • 2
  • a

    anthaugh

    08/08/2017, 4:32 PM
    I don't know if this was asked before, but
    toolbar
    in my app is swipeable away. I'm using it like this:
    coordinatorLayout {
        appBarLayout {
            toolbar { ... }
            relativeLayout { to be filled with content later }
        }
    }
    Is there any way to prevent this behaviour? I tried
    setCollapsible(false)
    to no avail
    m
    d
    • 3
    • 6
  • a

    anthonyandroid

    08/13/2017, 7:35 AM
    got this when I upgrade anko version from 0.9 to 0.10.1; why it start to complain about this issue in the new version?
    d
    a
    • 3
    • 4
  • a

    arild

    08/20/2017, 7:06 PM
    Please advise regarding the most correct (idiomatic) way to use Anko for Fragment UI creation. The whole
    UI {...}.view
    wrapping, where
    addView
    checks a boolean field to see if it should actually add view seems… inelegant
    m
    • 2
    • 1
  • s

    sebastian.janko

    08/22/2017, 6:48 PM
    i think that it's also written on the official github page. i know i saw it somewhere already.
    m
    e
    • 3
    • 4
  • d

    damianpetla

    09/18/2017, 11:54 AM
    Does anyone know why
    cancellable
    is gone when building alerts?
    o
    • 2
    • 6
  • s

    sqia09

    09/21/2017, 9:39 AM
    and finally my db manager where I'm querying:
    fun getCount(): Int {
            var listDbNodes = mutableListOf<DbNodeModel>()
            dbHelper.use {
                select(NodeTable.TABLE_NAME).parseList(object: MapRowParser<List<DbNodeModel>> {
                    override fun parseRow(columns: Map<String, Any?>): List<DbNodeModel> {
    
                       val routeID = columns.getValue(NodeTable.ROUTE_ID)
                       val siteId = columns.getValue(NodeTable.SITE_ID)
                       val activityId = columns.getValue(NodeTable.ACTIVITY_ID)
                       val equipmentId = columns.getValue(NodeTable.EQUIPMENT_ID)
                       val barcode = columns.getValue(NodeTable.BARCODE)
                       val scannedOn = columns.getValue(NodeTable.SCANNED_ON)
                       val scannedBy = columns.getValue(NodeTable.SCANNED_BY)
                       val deviceImei = columns.getValue(NodeTable.DEVICE_IMEI)
    
                        val dbNode = DbNodeModel(routeID, siteId, activityId,                   <----this is where I'm getting cast error
                                equipmentId, barcode, scannedOn, scannedBy, deviceImei)
    
                        listDbNodes.add(dbNode)
                        return listDbNodes
                    }
                })
            }
    
            return listDbNodes.size
        }
    a
    • 2
    • 1
  • d

    david.bilik

    09/22/2017, 12:58 PM
    by the way, Preview will be fixed in the upcoming release of AS plugin .. I’ve tried to build anko and generate jar with plugin and its working fine 🙂 https://github.com/Kotlin/anko/issues/470
    😀 1
    👍 1
    e
    v
    • 3
    • 2
  • s

    spragg

    10/11/2017, 1:28 AM
    Do any of the intellij anko team know if this issue is getting worked on ? https://github.com/Kotlin/anko/issues/153
    e
    • 2
    • 4
  • s

    Søren Krogh Neigaard

    10/13/2017, 11:15 AM
    Hi, I am new here, and new to Anko. I have this `AnkoComponent`:
    class ProjectCellView : AnkoComponent<ViewGroup> {
        var project: Project? = null
    
        override fun createView(ui: AnkoContext<ViewGroup>): View {
            return with(ui) {
                verticalLayout {
                    textView {
                        text = project?.title
                    }
                }
            }
        }
    }
    and my idea was to update its
    project
    in a adapter.onBindViewHolder so that it would show the correct title, but I use it in
    createView
    so that won´t work. What is the correct way to use a
    AnkoComponent
    in a RecyclerView adapter and bind its view's to data in the adapter.onBindViewHolder?
    m
    • 2
    • 1
  • s

    stantronic

    10/19/2017, 2:06 PM
    I’m looking for a way to do inline clickable link text, does anko provide a nice way to accomplish this?
    m
    • 2
    • 8
  • h

    hagabaka

    11/07/2017, 1:57 AM
    what is "anko-percent" used for?
    e
    • 2
    • 2
  • d

    david.bilik

    11/09/2017, 8:21 AM
    Hi, If you like ConstraintLayout but also love Anko and you have hard time using it together, my colleague created a library for you - https://github.com/AckeeCZ/anko-constraint-layout It provides nice DSL around ConstraintLayout with convenient shortcuts to create UI more easily 🙂 give it a try and file an issue if you have some problem
    👍 8
    🤘 1
    :kotlin: 4
    y
    • 2
    • 1
  • d

    david.bilik

    11/16/2017, 10:55 AM
    unfortunately not everything is possible to set programmatically. It depenends on the view and if its programmer is a good guy. You can see in the FAB constructor that mBorderWidth is private property set only from AttributeSet and its not possible to set it
    😞 1
    p
    • 2
    • 1
  • d

    damianpetla

    11/23/2017, 6:59 AM
    I wonder what motivated Anko team to switch from file CHANGELOG to gitHub release tags, anyone knows?
    v
    • 2
    • 1
  • s

    spragg

    11/28/2017, 5:36 AM
    @alberto have you looked at
    themedRelativeLayout()
    . Anko convention seems to be to have a themed version of all the views which takes a theme resourceID
    a
    • 2
    • 11
  • s

    spragg

    11/29/2017, 11:20 PM
    @vyacheslav.gerasimov I noticed that you latest commit in anko-sdk25 Layout.kt (1b5653cdb9648ebc316aeeb13179ebddfd91d4fa) removed the _WebView. Was that intentional, and has that definition been moved somewhere else?
    v
    y
    • 3
    • 8
  • d

    david.bilik

    12/12/2017, 6:19 AM
    we have created some extensions on View/Context to retrieving attribute resources eg. drawable
    /**
     * Get drawable defined by attribute [attr]
     */
    fun Context.attrDrawable(attr: Int): Drawable {
        val a = theme.obtainStyledAttributes(intArrayOf(attr))
        val attributeResourceId = a.getResourceId(0, 0)
        a.recycle()
        return drawable(attributeResourceId)
    }
    s
    • 2
    • 1
  • a

    adeln

    12/25/2017, 3:20 PM
    hey folks, what do you think about https://github.com/Kotlin/anko/issues/530 ?
    💯 4
    r
    m
    • 3
    • 4
  • l

    louiscad

    01/16/2018, 8:08 AM
    @maplonki It's because use close the database afterwards. Are you using it in a ContentProvider ?
    m
    • 2
    • 5
  • v

    voghdev

    02/06/2018, 12:11 PM
    I've workarounded it with various dirty hacks, but don't like the solution. Thanks in advance!
  • b

    bennofs

    02/14/2018, 11:30 AM
    what's the correct anko way to create a view in a viewholder if i'm using anko's layout DSL? the code I'm using right now is this:
    with(AnkoContext.create(parent.context)) { ...layout... }
    but that doesn't allow me to set layout params for example
    m
    • 2
    • 1
Powered by Linen
Title
b

bennofs

02/14/2018, 11:30 AM
what's the correct anko way to create a view in a viewholder if i'm using anko's layout DSL? the code I'm using right now is this:
with(AnkoContext.create(parent.context)) { ...layout... }
but that doesn't allow me to set layout params for example
m

miha-x64

02/14/2018, 9:17 PM
https://adel.lol/post/154221726637/anko-viewholders-and-applicative-lifting
View count: 2