Alright, In the new SDK found here: 
http://dl.google.com/android/android-sdk-windows-1.1_r1.zip
Google added an OrientationListener package
(android.view.OrientationListener) that has an onOrientationChanged
(int orientation) function. This helps immensly. However, I agree with
you Dianne, having a static px setting is a bad idea. I had just set
it to 200px height because it looked right on the emu, and I would
change it once the code for the app actually worked. See here for more
info on onOrientationChanged:
http://developer.android.com/reference/android/view/OrientationListener.html#onOrientationChanged(int)

If this was already in the SDK, I missed it. I was using 1.0r2, the
new one is 1.1r1

On Feb 13, 8:46 pm, Dianne Hackborn <hack...@android.com> wrote:
> I really, strongly recommend against solving this by having different
> layouts designed for different explicit screen sizes.  It won't help you
> when there is a device that is wide resolution so has a few more pixels
> along one edge or the other, for example.
>
>
>
>
>
> On Fri, Feb 13, 2009 at 9:30 AM, loty <lev.pert...@gmail.com> wrote:
>
> > I would also suggest using different layout files for different screen
> > sizes and orientation. It works very well and much easier to control
> > than any 'smart' resizing code. Look into API docs for explanation of
> > resource folder naming conventions.
>
> > On Feb 12, 7:26 pm, Timo Bruck <timot...@gmail.com> wrote:
> > > Android will automatically re-layout your views based on orientation (and
> > > screen size, too!), but you need to give it flexibility in setting the
> > view
> > > sizes to do that.
>
> > > I try to avoid using absolute dimensions for anything other than padding
> > or
> > > when I want a view to be a certain size regardless of screen size (e.g.
> > the
> > > height of a button).
>
> > > I think what you want to do is set the layout_height of your EditText and
> > > WebViews to 0px, and then add a layout_weight="1" to each of them. This
> > will
> > > tell Android to divide up any extra screen space between those two views
> > > equally.
>
> > > Alternatively, you could also have two different layout files (one for
> > > landscape and one for portrait).
>
> > > -Timo
>
> > > On Thu, Feb 12, 2009 at 3:54 PM, David <godsinven...@gmail.com> wrote:
>
> > > > Hello, I need to have my view resize itself based on the orientation.
> > > > After extensive googling (maybe i was using the wrong terms) I could
> > > > find nothing telling me how to detect when the orientation was
> > > > changed. Here is my layout file:
>
> > > > <?xml version="1.0" encoding="utf-8"?>
> > > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > > > android"
> > > >    android:orientation="vertical"
> > > >    android:layout_width="fill_parent"
> > > >    android:layout_height="fill_parent"
>
> > > >        <EditText android:id="@+id/htmledit"
> > > >                android:layout_width="fill_parent"
> > > >                android:layout_height="200px"
> > > >                />
> > > >        <WebView android:id="@+id/htmlview"
> > > >                android:layout_width="fill_parent"
> > > >                android:layout_height="200px"
> > > >                />
> > > > </LinearLayout>
>
> > > > how do I have it automatically resize itself? I want each item (the
> > > > EditText and the WebView) to fill half the screen (not counting the
> > > > title/notification bars). I set the height to absolute and not
> > > > wrap_content because wrap_content defaults to 1 line for EditText and
> > > > nothing for WebView. and fill_parent has the EditText on top of the
> > > > WebView.
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to