[英]how much can a scrollView scroll?
I have a layout with a scrollView inside it.我有一个布局,里面有一个 scrollView。
How can I calculate what's the possible scroll size?我如何计算可能的滚动尺寸?
I would think:我会想:
(scroll's content desired height) - window.height = (invisible content height)
But how do I get the scroll's content actual desired height?但是我如何获得滚动的内容实际所需的高度?
I can get the scrollView height, which is not what I need.我可以获得 scrollView 高度,这不是我需要的。
I saw this post , but I don't get the calaulation.我看到了这篇文章,但我没有得到计算。
int diff = (view.getBottom() - (getHeight() + getScrollY()));// Calculate
// you can do it by the following two attributes in xml in scrollview it will scroll
//accroding to the child views it contain
android:animateLayoutChanges="true"
android:orientation="vertical"
//here is the full example
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:animateLayoutChanges="true"
android:orientation="vertical"
tools:context=".fragments.frag1"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bgsecond"
android:layout_marginBottom="40dp"
>
</RelativeLayout>
</ScrollView>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.