Any idea's why this font isn't wrapping correctly?
# android
g
Any idea's why this font isn't wrapping correctly?
ahh... it was the scroll view inside the tableview that needed to be setup. This is my first real android app. Still don't fully understand all these XML files... even why they exist. Sort of getting the impression I should create a row template in XML and pass it values from Kotlin rather than trying to build it with kotlin.
k
This view looks like it could use a RecyclerView instead. A bit more complex but you don't have to use a ScrollView
a
either way your instinct is right, constructing view trees by hand is pretty tedious and the workflow is optimized around inflating xml templates and binding values instead
g
thanks I'll check it out... learning android is a little tougher than I anticipated.
a
you might find the data binding library useful, or if you're up for using some prerelease tooling, the new viewbinding stuff
k
I would recommend an online class. Pretty hard to do on your own
a
yeah the learning curve is really steep in the beginning. We're working on it. 🙂 there's some neat stuff incubating over in #compose too
g
Yeah? I've learned so many languages on my own... android is a little unique
k
I'm learning a new language/platform now, and taking a class really shorted the learning curve
g
I guess that makes sense, I took a kotlin for java developers course recently.
a
https://developer.android.com/courses/ has some codelabs that you might find useful, it's been a while since I looked over the material presented there though to have an opinion on it
k
Also, sign up for a newsletter like: https://androidweekly.net/
g
thanks. i guess my biggest questions revolve around how the xml gets turned into a layout... and why the folder structure is the way it is, how to modify and build on it.
a
reflection to invoke the view constructor and plain old calls to
addView
as it recurses through the tags
aapt does some compression on the xml file at build time so that it's cheaper to parse at runtime
if you see reference to 'binary xml' around the docs that's what it's talking about
g
interesting
l
If you're going to make UIs with code on Android, until Jetpack Compose, I recommend you try Splitties Views DSL (which I'm the author of), it makes it significantly nicer to use than without Kotlin extensions like you currently do: https://github.com/LouisCAD/Splitties/tree/master/modules/views-dsl I've been using it for about two years now, used xml the two years before.
g
If you are beginner I highly recommend to use XML and do not even try build layouts in code, just use standard Android practises from official guides. Doing this from code will not help at all, actually lack of tooling support such as preview, styles etc will make everything much harder if you don't know how to manage this from codr
✔️ 5