Home  >  Q&A  >  body text

android - 有什么办法可以精确地使ScrollView刚刚好填充满整个屏幕吗?

我想让ScrollView的上面部分内容填充满整个屏幕,就像使用普通的布局那样的效果。然后往下拉后就可以看到下面的其他布局内容。

现在我遇到的问题是不知道怎么控制上面那一部分内容刚刚好填充满整个屏幕,因为不同的手机分辨率不同,我也不好设置固定的dp距离。总是会有一部分内容超出屏幕显示,或者内容高度比屏幕小而出现了下面部分布局的情况。

请问有什么解决方法吗?

PHP中文网PHP中文网2729 days ago513

reply all(3)I'll reply

  • 黄舟

    黄舟2017-04-17 14:42:36

    android:fillViewport="true" ?

    reply
    0
  • 黄舟

    黄舟2017-04-17 14:42:36

    Get the width and height of the screen in the code and set it dynamically

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 14:42:36

    Similar to pull-down refresh, first hide the lower part, then get the sliding event and then display it

    reply
    0
  • Cancelreply