Did you guys switch over to anko or do ye still us...
# android
r
Did you guys switch over to anko or do ye still use xml for layouts? Do you think Anko Layouts will replace xml?
l
I used Anko, then went back to xml, then did my own View DSL that you can try: https://github.com/LouisCAD/Splitties/tree/master/viewdsl To make it short: it is lighter than Anko, and more flexible. I've been using it in production for months
❤️ 1
e
Still xml, cause the preview of anko is often broken lol
❤️ 1
l
Missing flexibility in Anko layouts and low re-usability in xml was my primary incentive to make Splitties View DSL.
e
Xml is low re-usability?
l
Yes, no extension functions, tightly coupled to code in host Activity/Fragment
g
XML, especially with constraint layout. I still have filling that declarative XML is better choice.
1
e
xml can be decouple easily and recompose just like DSL using
<include>
, if you have ALL xml tightly coupled to activity/fragment, there must be something wrong
1
r
XML is way better especially with constraint layouts... Anko, is a cute project, but having to do all that nesting can be annoying. it will never replace XML. And I mean never lol
❤️ 1
1
l
@edwardwongtl Where all those findViewById are done? In an Activity or a Fragment, right?
I wouldn't say xml is way better, but I'd say it's better supported in the IDE (especially with ConstraintLayout).
e
They can be done any where as long as you have the
View
, it can be inside a viewholder of recyclerview
l
Yes, but then, your ui is split between an xml file and a source code file
e
Much much better support for xml, especially the preview
s
Same for me. Would love to make views programmatically if the tools supported it properly.
l
@sindrenm Did you try Splitties View DSL I mentioned above? Tools support is good enough for me, I can use preview if needed, and Kotlin support is all that is needed in regards of IDE support
s
@louiscad: I haven't tried it yet, although I saw you mentioned it some time ago in another thread! Will give it a go in the near future on a personal project. simple smile
l
@sindrenm You should try the sample before trying it in your project, so you can get to know it without writing code
👍 1