Thank You Kostya,
I did as you said and it works. Here is what I have done:
RelativeLayout myRelativeLayout = new RelativeLayout(this);
myRelativeLayout.setGravity(Gravity.CENTER_HORIZONTAL);
ScrollView.LayoutParams myRelativeLayoutParams = new
ScrollView.LayoutParams(
ScrollView.LayoutParams.FILL_PARENT,
ScrollView.LayoutParams.FILL_PARENT);
myRelativeLayoutParams.gravity = Gravity.CENTER;
myRelativeLayout.setLayoutParams(myRelativeLayoutParams);
ScrollView sv = new ScrollView(this);
sv.addView(myRelativeLayout);
So, this way I managed to do what I wanted. I just don't understand
why I had to reference LayoutParams of ScrollView instead of
RelativeView. Can somebody please explain. 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