Android: RelativeLayout in ScrollView

后端 未结 4 1373
抹茶落季
抹茶落季 2020-12-05 07:04

I have a RelativeLayout with multiple ImageViews and when I turn around the screen, the ImageViews become disordered. So I decided to

4条回答
  •  隐瞒了意图╮
    2020-12-05 07:51

    When you use the ScrollView, you should know that you only can scroll when height of ScrollView smaller than height of ScrollView's child.
    To solve this problem, you can define the Height of LinearLayout to match_parent, which is the only child of ScrollView. Then define the Height of ScrollView in the Java code, like scrollView.getChildAt(0).getHeight() - 1; to make sure the height of ScrollView smaller than height of ScrollView's child.
    For your own answer, it's not a good way to use magic numbers in your code, like 427dp and 548dp.

提交回复
热议问题