tags:

views:

867

answers:

2

Hi

I cant find a way to set the orientation on my SlidingDrawer when i change from landscape mode to portrait mode visa versa.

Initially i set the orientation by xml to vertical. I need to change the orientation to horizontal when the phone is in landscape mode, so i get the handle on the left.

Any ideas anybody?

+1  A: 

I do not believe that is possible with the standard SlidingDrawer. You may be able to implement your own drawer (perhaps a subclass of SlidingDrawer) that implements this functionality.

SlidingDrawer appears to be limited, in large part, to what is needed for the application drawer in the standard Android home screen. That drawer always stays anchored to the same physical side of the screen (bottom if portrait, right if landscape).

CommonsWare
Since it is possible to change the orientation by xml from horizontal to vertical, I guessed the same can be done in some magic way also by code. Its just that i dont know which element holds this setOrientation. Eighter SlidingDrawer og the LayoutParams of the drawer has any orientation method or property, (unlike LinearLayout)...im still hoping to find a way to do it by code...
PHP_Jedi
If i cant find any workarounds on this, I could always make it look like it works, by Creating 2 SlidingDrawers int the main.xml layout, one to have orientation vertical and the other horizontal. If each SlidingDrawer got a unique name, i could start the application by hiding one and display the other. When the device changes orientation. I hide the first, and set visibility=true on the second... Yes, its ugly, but will work. One drawback is that I also would have to implement the content layouts, with its listener...
PHP_Jedi
A: 

Isn't it as simple as putting one main.xml in the layouts for landscape mode (layout-land) and the other in the layouts for portrait mode (layout-port). Or am I missing something?

Robert Simpson