Upon closer examination it looks like the older versions of Android are using exactly half of the margin declared, but only for views that are center aligned (vertically or horizontally). For example, if I anchor an imagebutton to the right, then set a right margin of 10, it works. But if I center the imagebutton and set a right margin of 10, older versions of Android will set the margin to 5. I didn't realize the numbers were wrong from the get-go (I used the visual layout tool in the SDK), so I thought 2.2 was the culprit when my imagebuttons were so spread out.
I suppose the best way to handle this is to fix all the margin numbers in my XML files, then programmatically divide the margins by half on the centered imagebuttons for older versions of Android. Then if/when the day comes when anything below 2.2 is no longer being used, just remove that code. Unless a better solution presents itself, I'll stop talking to myself now. On Jun 3, 3:11 pm, mp6800 <[email protected]> wrote: > I guess the better question to ask is, how do I make the layout work > on older versions of Android after I fix the margins for 2.2? Do I > have to create a separate XML and put it in a "v8" layout dir? > > On Jun 3, 12:35 pm, Romain Guy <[email protected]> wrote: > > > > > > > > They're not going too far. From what I can tell, your layout was > > > relying on a broken behavior in previous versions of Android. > > > > On Thu, Jun 3, 2010 at 9:33 AM, mp6800 <[email protected]> wrote: > > > > Thanks for the reply. What about the positive margins? They're doing > > > > the same thing (going too far in 2.2) > > > > > On Jun 3, 12:26 pm, Romain Guy <[email protected]> wrote: > > > >> You are using negative margins, which has an unspecified behavior. > > > > >> On Thu, Jun 3, 2010 at 5:48 AM, mp6800 <[email protected]> wrote: > > > >> > Some more info on this - Turns out it /does/ affect top & bottom as > > > >> > well as left & right. I posted screenshots and a sample Eclipse > > > >> > project here: > > > > >> >http://www.anddev.org/view-layout-resource-problems-f27/layout-margin... > > > > >> > -- > > > >> > You received this message because you are subscribed to the Google > > > >> > Groups "Android Developers" group. > > > >> > To post to this group, send email to > > > >> > [email protected] > > > >> > To unsubscribe from this group, send email to > > > >> > [email protected] > > > >> > For more options, visit this group at > > > >> >http://groups.google.com/group/android-developers?hl=en > > > > >> -- > > > >> Romain Guy > > > >> Android framework engineer > > > >> [email protected] > > > > >> 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 [email protected] > > > > To unsubscribe from this group, send email to > > > > [email protected] > > > > For more options, visit this group at > > > >http://groups.google.com/group/android-developers?hl=en > > > > -- > > > Romain Guy > > > Android framework engineer > > > [email protected] > > > > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

