I\'ve got the following problem: I implemented a HorizontalScrollView which contains in one case a LinearLayout and an ImageView. In t
HorizontalScrollView
LinearLayout
ImageView
I think , this one will work for you
FrameLayout.LayoutParams layoutParams = new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams1.gravity(YourGravity); yourImage.setLayoutParams(layoutParams);