I have ScrollView with RelativeLayout as a child of ScrollView.
I am trying through JAVA code to set Layout_Gravity to CENTER so my
RelativeLayout is centered (horizontally and vertically) in the middle
of ScrollView (that covers whole screen). This works fine in XML and
produces desired result, but when I try to do this programmatically,
it seems there is no way to set Layout_Gravity of RelativeLayout. I
tried using LayoutParams, but couldn't find anything there that would
help me to center RelativeLayout in the middle.

So, am I missing something or this simply can't be done?

RelativeLayout.setGravity() is setting positioning for children, in
case that somebody wants to mention this one. AddRule is dealing with
children, so this doesn't work as well.

2nd part of the question...
The reason I am using ScrollView is because on my XML layout, I use
ViewFlipper.
ScrollViews are children of ViewFlipper, actually pages that will be
flipped. Using ScrollView seems little bit weird, but I couldn't find
any other alternative. The ScrollView is the only control on which I
could attach onFling event. I tried attaching onFling directly to
Layout, but that didn't produce anything, onFling didn't fire. Any
suggestions?

Thanks....


-- 
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

Reply via email to