Layout Based on Orientation

by Scoz » Sun, 07 Sep 2008 04:30:35 GMT


Sponsored Links
 Currently trying to have a dialog that will allow the user to sign in
to a service using a Webview. Using a simple LinearLayout works while
while the phone is held in portrait mode, with the message and button
on top leaving a nice squareish webview. When switching in to
landscape mode though I end up with an unusably low height webview as
the message and button are still on top.

Is there any way to specify a layout based on the current orientation?

--~--~---------~--~----~------------~-------~--~----~



Layout Based on Orientation

by Mark Murphy » Sun, 07 Sep 2008 04:33:32 GMT


 


Sure. Put one layout in res/layout and another in res/layout-land. Here, 
layout-land effectively means "use this layout when the device is in 
landscape orientation".

When the device is rotated, your current activity will be closed 
(shortly after onSaveInstanceState() is called) and then restarted with 
the appropriate layout set. Reload your widgets from the instance state 
supplied to onCreate()/onRestoreInstanceState(), and you're set.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 1.1 Published!

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Layout Based on Orientation

by Scoz » Sun, 07 Sep 2008 07:59:15 GMT


 Awesome, this is exactly what I needed, thanks :D






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. cara register di cnectd (",

Dear suhu/suhi. Mau tanya cara register di cnectd. Beberapa hari
sebelumnya saya coba instal melalui http://cnectd.getjar.com namun
selalu gagal dan ketika berhasil download malah ga bs instal karena
tidak mengenali aplikasi tsb (kemungkinan yg terdownload adalah buat
symbian). Tiba2 hari ini di spica saya sudah terinstal cnectd
(sebelumnya spica sy lg dipegang2 sm bos yg tertarik sm android) namun
meminta username dan password. Karena saya belum ada account akhirnya
saya coba register di http://home.cnectd.com/ tapi kok ga nemuin sign
up ya? Ada yg bisa bantu ga??? Thanx b4 and after.

-- 
"Indonesian Android Community [id-android]" 

2. Control file and network acces

Hi,

I'd like to understand what the different possibilities to control file and 
network access are (e.g. to implement a personal firewall which is able to 
control all running apps)? On a traditional Linux I'd choose a LSM hooks based 
approach to control all file and network access. Depending on the exact 
architecture that would mean I also had to deploy a kernel module which is able 
to communicate (e.g. netlink) with my application running in the user space. 
Such an approach would make it impossible to distribute the application through 
the AppStore. Is there any better approach?

Yesterday Symantec announced [1] the release of such a mobile security 
solution. Apparently it has an integrated firewall. How is that possible with 
the given Android security model?

Can someone shed some light on the architecture of such a solution?

Thanks and regards,
Yves

[1] http://www.symantec.com/about/news/release/article.jsp?prid=20100527_01

3. Source for account storag

4. USB drivers for HTC Legend ? (or, how to add your own to android_winusb.inf )

5. HELP: foursquare & pasar malam

6. N1 on CM-5.0.7.1 Force Reboot.

7. Our Android Google AdSense Account Disabled due to 'modifying the ad behavior'