Do I have to use XML to build the interface in Android Apps? I don't like XML and I would rather write the interfaces out in Java.
In iOS, you can write your interfaces using Interface Builder/Storyboards, or you can just write them by hand in code, which I think is better.
Do I have to use XML with Android?
You can avoid the XML (but not the Manifest file : AndroidManifest.xml
).
From Android Website :
Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory.The manifest presents essential information about the application to the Android system, information the system must have before it can run any of the application's code. Among other things, the manifest does the following:
You can get more informations here : Create App without XML (try to search before posting)
Leaving the manifest aside, you can, of course. All of the XML mumbo jumbo eventually maps down to code, and Android exposes that functionality.
Now, do you really think its better to eschew the XML layouts? Your code, I think, should be worrying about behavioral logic, not presentation logic. The XML facilities allow you to extarnalize most of the presentation logic, so that it doesn't clutter your code.
I've personally, constructed a large visual library. Windows, ddlb's, date pickers, lists, custom image buttons, text edit areas.. Not a lick of XML.. I've tested layouts on a little phone, and on a 7in tablet. All good.
It can be done, but it's a lot of work. The plus is, my controls look like my controls. They have a flavor to them that is utterly under my control.
Everything is of course abstracted, so when I'm writing "the behavioral logic" that's all I care about.
Oh another plus.. when I take the code to another language (c++, c# or objective c) the apps look the same, because I have the exact same abstraction (with in limits of the languages).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With