vendredi 8 mai 2015

Handling code for different layouts

Please help me with following issue I am facing.

my application has list of items to show, and when the list item is clicked a detail view is shown on frame layout.

I created two layout xml files

main.xml (for vertical orientation)

main.xml (for horizontal orientation)

vertical layout has one framelayout, and horizontal has two framelayout (two column).

On horizontal: item lists are shown in first framelayout (1st column), and the detail is shown in second framelayout (2nd column).

On Vertical: both are shown in single frame layout (i.e. when item is clicked, same framelayout loaded with detail view)

while detail view shows on vertical orientation, when I change the device orientation to horizontal I could see the detail view is loaded to 1st column. instead of second. how to solve this?

I could see there are lots of examples explains having two different layouts, but i could not find good example how to handle the code when orientation changes.

Aucun commentaire:

Enregistrer un commentaire