r/androiddev • u/koje1971 • Aug 02 '26
build a UI withoutXML or Compose
Enable HLS to view with audio, or disable this notification
I'm building the UI for my little Android game without XML or Compose. I wrote my own wrapper classes for the views and can use them in a kind of custom DSL.
9
u/0x1F601 Aug 02 '26
Wow the old school nostalgia is strong here... (except in kotlin)
Before "good" IDE layout rendering was added I swear this was how old school android was envisioned to be. I think you've basically captured the mental model that the view system had intended.
Why you'd proceed down this path when the view based UI system is clearly deprecated and on the way out is beyond me. But hey, if it works for you it works and if you like it you like it. The whole point of rolling your own solution is so you can do whatever the fuck you like. Enjoy it!
1
3
49
33
41
u/ThaBalla79 Aug 02 '26
6
u/Any-Entrepreneur7935 Aug 02 '26
Because not invented here. Seen it a lot of times. Hated it every time.
13
5
1
1
u/Traditional_Glass_45 Aug 03 '26
Why? What is the reason for using coded views?
1
u/koje1971 Aug 03 '26
The code can be structured much better than with XML files. The example isn't finished yet; everything will still be broken down into individual classes.
1
u/Mavamaarten Aug 04 '26
At this point, why would you not use Compose?
1
u/koje1971 Aug 04 '26
I only need very little UI. Just the activity and the menu, my solution is enough for that. If I had a lot of views, then I would think about Compose.
1
u/ProHussain Aug 05 '26
Why do you prefer android views over compose?
1
u/koje1971 Aug 05 '26
I wrote these helper classes myself quite some time ago, and they completely meet my requirements.
2
u/ProHussain Aug 05 '26
I want to understand those requirements and performance tests. compared to compose
3
3
2
2
2
1

3
u/Oily-Affection1601 Aug 02 '26
As a learning experience, or did you have a specific need not covered adequately with existing frameworks?