Android - Set Layout_Gravity programmatically for LinearLayout

前端 未结 3 1139
执笔经年
执笔经年 2020-12-15 23:15

I\'ve got the following problem: I implemented a HorizontalScrollView which contains in one case a LinearLayout and an ImageView. In t

3条回答
  •  时光取名叫无心
    2020-12-16 00:09

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

提交回复
热议问题