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) 
_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. hTC Desire getting official Android 2 . 2 rollout tomorrow

Official: HTC rolling out Android 2 . 2, 720 p video , iTunes sync to
unlocked Euro Desires this weekend
Posted Jul 30th 2010 6 : 45AM by Vlad Savov
We' ve just heard directly from HTC regarding
that hotly anticipated upgrade to Android 2. 2 :
it' s happening this weekend for lucky Euroland
owners of the Desire . Provided your Sense -
laden 3 .7 - incher is not carrier - locked , you
should be receiving your serving of Froyo by the
end of the week, together with a new 720 p
video mode and iTunes sync for your music .
HTC is also throwing in its App Share widget
that it first introduced with the Wildfire, along
with its smart Caller ID feature. Very nice ,
though it ' s quite a shame that operator - specific
versions of the update are still stuck in testing
and are expected "in several weeks' time . " Ah
well , guess that ' ll teach us to buy our gear
"The Android 2 .2 ( FroYo ) update for HTC Desire
will start rolling out across Europe this
weekend. As well as including the complete set
of Android 2 .2 features , the update will contain
a few special additions of our own through the
latest iteration of HTC Sense. The update will
provide 720 p video capture , HTC ' s App Share
widget, as well as our enhanced HTC Caller ID ,
and improved multi- language keyboard . Also ,
through the update , HTC Sync will allow HTC
Desire users to sync their music with iTunes .
HTC Desire users will be notified that the over -
the- air update is available to download when
their phone automatically checks for software
updates . The update won' t delete any of the
phone' s content . However, due to the size of
the update , we would advise using a WiFi
connection to download it wherever possible to
avoid additional data charges.
This update will initially roll out to unlocked
HTC Desire handsets. Operator specific versions
of the update are undergoing testing and we
expect to make them available in several weeks'
time ."


hTC Desire FroYoSENSE UIROM: 2.06.832.1
Built: FRF91

2. people.NUMBER is deprecated....what else i can use in place of it

It's probably also showing what you should be using instead.

TreKing <> - Chicago
transit tracking app for Android-powered devices


3. problem using listview...

4. UD 5.0.1

5. Ponsel Android Bisa Nyalakan Mobil

6. UI Widgets/Layout/Tools

7. kamus translate v1.0