Cómo implementar un diseño de múltiples ventanas (como el navegador predeterminado) (Editor con varios archivos abiertos)

I am writing an editor (of sorts) which I want to be able to have multiple windows open at the same time, and I want to be able to navigate between windows as can be done in the default browser (Internet) application. See picture: http://i.imgur.com/LM6Nz.png para aclaraciones

My question is how to implement these windows; Do I want each window to be an own (Editor) Activity, should I use Fragments (I am mainly designing for API 10, and Fragments arrived in API 11, but I read somewhere this should be fine). Or do I simply hack together some different Views in a ViewGroup?

If I use Fragments, do I place them in a ViewGroup?

preguntado el 31 de julio de 12 a las 12:07

I am not able to see the posted screen link. Please update it to visible one and we will help you. -

3 Respuestas

Fragments were meant for scenarios similar to the one you are facing. Think about it, you need to show them all in the same activity so an Activity won't be a proper option. At the same time you'll want for all of them to work independently and to manage their own lifecycle internally. You can support fragments since API no. 4, by using the compatibility library. (http://developer.android.com/tools/extras/support-library.html)

Ultimately you can group them as you like/need. That's one of the other strengths of fragments. From the most basic container (FrameLayout) to the richest galleries such as ViewPager.

Respondido 06 ago 12, 22:08

I developed a similar app with four tabs (and more can be added if desired). One for a webview, one for a facebook app and two others. I started them as one single activity and put all the views in one single xml file (under different tabs). Worked pretty fine for me.

Are you encountering any problems or just want a better way to do this thing?

Respondido 06 ago 12, 11:08

What you've provided like sample seems like gallery - you can put there a custom view (override getView and inflate what you want).

If you want unlimeted windows you have to use structures like gallery (dynamicly load all neccessary information). Create you own layout and in getView you can fill it how you like. And for example onItemClick you can go to the other activity etc to open it fullscreen.

If you need only preview like in provided sample - you can create a simple gallery with preview images, if you want some actions (maybe textviews etc) you can do it as i described above

Respondido 02 ago 12, 13:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.