Hello, I have exaclty the same problem: If I put a LinearLayout on a ScrollView the margins of all views inside the layout are not displayed anymore - if I remove the ScrollView from the hierarchy the margins are there (but obviously no scrolling).
I workarounded it also with an empty View as replacement for the margin but it is flickering when scrolling (pretty much more than without empty views). Would be great if the margin issue could be fixed. Szymon On Sep 9, 2:29 am, Jason Proctor <[email protected]> wrote: > i tried to get round this by having an invisible view hierarchy which > i could effectively clone by loading it using the LayoutInflater. > > well, got headed off at the pass there too. i get a > Resources$NotFoundException, resource ID blah type blah is not valid. > can LayoutInflater not inflate Views from layout XML? from the docs, > that looks like its job! > > it seems i'm hosed here. i logged a bug about setPadding() and > setMargins() because IMHO they should work. > > (this might be related to another issue i saw with the relationship > between factory-inflated stuff and then calling setters. if i > construct a ProgressDialog using the helper factory method, then it > ends up being indeterminate regardless of the setting of the > appropriate flag. but if i call the same damn methods manually, then > i can control the indeterminate flag just fine. looking at the code, > it's calling the same stuff i am. wtf??) > > > > > > >What is top_view? > > >On Thu, Sep 3, 2009 at 2:12 PM, Jason > >Proctor<[email protected]> wrote: > > >> sorry - i thought that mentioning i'd tried setPadding() and > >> MarginLayoutParams was enough to give an idea of what the code looked > >> like. > > >> // assuming > >> ViewGroup group = (ViewGroup) findViewById (R.id.top_view); > > >> // try 1 > >> WebView web = new WebView (this); > >> webView.setPadding (30, 10, 30, 10); > >> group.addView (web); > > >> // try 2 > >> WebView web = new WebView (this); > >> ViewGroup.MarginLayoutParams params = new > >> ViewGroup.MarginLayoutParams (ViewGroup.FILL_PARENT, > >> ViewGroup.WRAP_CONTENT); > >> params.setMargins (30, 10, 30, 10); > >> group.addView (web, params); > > >> in both cases the WebView fills the parent's width, despite the > >> padding set up in the first snippet or the margins set up in the > >> second snippet. > > >> however, if i declare the webview in the layout file, as such -- > > >> <WebView > >> android:id="@+id/web_view" > >> android:layout_width="fill_parent" > >> android:layout_height="wrap_content" > >> android:layout_marginLeft="30px" > >> android:layout_marginRight="30px" > >> android:layout_marginTop="10px" > >> android:layout_marginBottom="10px" > >> /> > > >> then the webview insets appropriately. > > >> any help appreciated! > > >> thanks, > >> j > > >>>Without seeing your code... > > >>>On Thu, Sep 3, 2009 at 12:00 PM, Jason > >>>Proctor<[email protected]> wrote: > > >>>> anyone? this is a fairly simple thing to want to do, and the > >>>> documented ways of doing it don't work. do i log a bug? > > >>>>>hey -- i'm programmatically adding views to a LinearLayout inside a > >>>>>ScrollView and i'm running into some issues setting margins and > >>>>>padding etc for child views of the LinearLayout. > > >>>>>i've tried child.setPadding() and adding the view with a > >>>>>MarginLayoutParams set up right, but the child view still fills the > >>>>>parent width. > > >>>>>what is the correct way to programmatically set the parameters which > >>>>>are set statically by layout_marginLeft, layout_marginRight, etc? > > >>>> -- > >>>> jason.vp.engineering.particle > > >>>-- > >>>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 > > >> -- > >> jason.vp.engineering.particle > > >-- > >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 > > -- > jason.vp.engineering.particle- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

