0

I have a ScrollView which child's height is 500px,this contain 2 button and the sum of height of them is 500px.but the value of child.getHeight() is 788 not 500 I know ScrollView extends Framelayout,i replace the ScrollView with Framelayout in the same scene and the value of child.getHeight() is 500.

Why is this happen?

ckruczek
  • 2,361
  • 2
  • 20
  • 23
wanglugao
  • 281
  • 2
  • 10

1 Answers1

0

As per my knowledge and what i found on serch is, when you use scroll view the scroll view adds some padding inside its child elements for its comfort. but in case framelayout this not happens so you are getting these different values for scrollview and framelayout. as you can see android:margin not works for scrollview but works for framelayout. you can see these two examples for understanding- margin issue

difference between padding and margin

Community
  • 1
  • 1
sud
  • 505
  • 1
  • 4
  • 12