mertaydin
mertaydin

Reputation: 2244

How can I implement this Fragment based layout?

I want to make a appliaction for tablets. There will be a mainactivity and will include a map on it. And other fragments will be on it.

For example, I think, this figure is telling what I want.

The figure http://imageshack.us/scaled/landing/62/fragmentr.png

Map will always be there and the listview will on it on the left for example. Is it possible on android? And in which way I can do it?

Upvotes: 0

Views: 110

Answers (2)

Philipp
Philipp

Reputation: 69663

Yes, this is possible. You can create an XML file which describes the arrangment of the UI elements on the screen and then write the code which initializes and manages these UI elements. Details and examples can be found in the official API guide:

http://developer.android.com/guide/topics/ui/declaring-layout.html

In this case you would create a vertical LinearLayout with three elements:

  • a TextView (header),
  • a horizontal LinearLayout (map and map list) with two elements:
    • a MapView for the map
    • a TextView for the list
  • a horizontal LinearLayout (menu) with various Button elements

Upvotes: 1

karllindmark
karllindmark

Reputation: 6071

More of a pseudo-approach, but hopefully it'll send you down the right path.

You could use an ActionBar as the header, a MapFragment and a ListFragment for the content itself. The menu is up to you, depending on what you want it to do. :)

Upvotes: 0

Related Questions