Is there a way to write snake case view ids in XML...
# android
a
Is there a way to write snake case view ids in XML and use camel case variable names for the view in Kotlin while using Kotlin Android extensions plugin? I don’t won’t to break conventions and use camel case as view ids in XML, but it seems that there is no other way
d
no, you can use Android Data Binding instead
2
2
a
Would it make sense to only use it for views injection?
d
sure
g
You don't want this can of worms, called Databindings. You can easily achieve desired behavior via import aliases: import snake_case_id as camelCaseId. Now, it's an open question if it worth the trouble. A lot of people just switch to camelCase in XML (even Google is not consistent here). Alternatively, some people actually find snake_case in Kotlin useful, because it helps to visually distinguish your views from regular variables.
d
Worms?
a
import aliases could make sense if it can be automated somehow, but I think it should have been under the hood
l
I think Google just announced like a view binding lib during IO, you can take a look at the keynotes
a
yeah, saw that on Twitter yesterday. but I think it’s not available now… have to check release dates, but that is great news!
@louis993546 I think I saw you yesterday in Google Berlin 🙂 Let’s meet-up next time 😉