So, I am new to coding and new to Android. I am running through tutorials and examples on the web. The Google Tutorial is a challenge for me to understand, but I am trying and I think I have the Shakespeare application working.
I thought it was a neat trick that the OS automatically switches the layout when the phone switches from portrait to landscape. I think I followed the tutorial and built:
- Initial java class with 2 XML layouts, one in the root folder and one in -land folder. The -land folder has a separate FrameLayout with id: fragment_details.
- A java class for the "left" or "first" panel. The UI is initially filled by a setListAdapater object (I think, if I understand it correctly).
- A java class for the "right" or "details" panel. The UI is filled by a scroller object (I think, if I understand it).
Q1. So I have these XML files for the left panel and the right panel and I am not sure I need either, or I only need the "right" panel XML with some "holder" object with the right reference ID.
Q2. Why can't I just have the main java class CreateView either of the two similarly named, top-level XML files and create adapters for custom listviews that I describe in XML files? Essentially, why does Google recommend creating the scroller and ListFragment through code instead of using views defined explicity? The OS would just switch between the layouts as necessary, no?
Aucun commentaire:
Enregistrer un commentaire