6
mukund
7y

Not sure if I am Allowed to ask general questions here but here's the thing. I just began making Android apps. I have made a few basic of them and I use constraint layout via the layout editor in Android Studio. Is it okay? Do professionals do the same or do they actually type in the xml code?

Comments
  • 2
    I use both. Drag and drop to do the basic thing and then you can go to the xml editor and add extra things since its easier to look at the code and edit it, but the drag and drog can help you save timr rewriting all those stuff again and again
  • 4
    No problem at all. It totally depends on your preferences. But i recommend using the source editor because it is IMPOSSIBLE to make complicated layouts with the layout editor.
  • 0
    I prefer the xml way. Though it'll take lot of time and practice before you can be perfect.
  • 0
    Or use ionic, react-native, cortona,... to build your app :D
  • 0
    I generally treat my apps like a game.

    I will create a main layout with drag and drop then that will launch game loop, and that doesn't require either XML or drag and drop. Just build it programmatically so there no device size issues.
  • 2
    Sucks at margins(esp heights)?
    If it isnt for production, use

    <Space
    android:width="match_parent"
    android:height="NUMBERsp"
    // 20sp always works right
    </Space>
  • 0
  • 0
    @thecode I really suck at xml. I don't even Know what to write to insert a Imageview.
  • 0
    @CozyPlanes How to progress? Drag drop element and then later edit their alignment and other things in the editor?
  • 0
    @DavidKevork Should I keep practicing both side by side or essentially focus on writing xml?
  • 0
    @mukund I also dont know xml alot but when you use drag and drop and learn the xml and play with the xml you will be better at the xml and prefer xml over editor but sometimes when you are inserting buttons or inputs you can save some time and typing by using the drag and drop and edit the rest of it in xml, since when using the xml you feel easier to edit and customize it the way you want rather than using the drag part and scrolling to be able to edit
  • 1
    @mukund explore some stuff.
    Do stuffs. Wasting 1 hour doing things will be very helpful. Just turn on Preview button on the right vertical tab.
  • 0
    @mukund you type a <I and then press ctrl+Space and it'd suggest you by itself. Press enter. Set the layout_width and layout_height properties as per your requirement, followed by any additional properties you need to add to it.
  • 0
    For constant layout, I use the editor. For everything else, XML.
Add Comment