Java 如何在安卓系统中制作一个布局,直到滚动视图被滚动到某个特定的位置,它也被滚动到屏幕的底部?

Java 如何在安卓系统中制作一个布局,直到滚动视图被滚动到某个特定的位置,它也被滚动到屏幕的底部?,java,android,xml,user-interface,Java,Android,Xml,User Interface,我想制作一个android活动屏幕,在屏幕底部粘贴一个布局,直到scrollview滚动到某个位置。如本视频示例中的链接: 使用a,并将按钮容器放入其中。 将以下属性传递给\u scrollview\u activity.xml中的容器 <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout

我想制作一个android活动屏幕,在屏幕底部粘贴一个布局,直到scrollview滚动到某个位置。如本视频示例中的链接:

使用a,并将按钮容器放入其中。 将以下属性传递给\u scrollview\u activity.xml中的容器

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Button 1 (reft)" />

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Button 2 (right)"/>

    </LinearLayout>

</RelativeLayout>

注意:您需要在活动中设置一个侦听器,以获取滚动视图的当前位置/当前高度。使用此当前高度,您可以计算滚动视图底部/末端的“左空间”。如果您的RelativeLayout到达底部或接近底部且在可见区域内,则调用您的动画。

使用a并将按钮容器放入其中。 将以下属性传递给\u scrollview\u activity.xml中的容器

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Button 1 (reft)" />

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Button 2 (right)"/>

    </LinearLayout>

</RelativeLayout>

注意:您需要在活动中设置一个侦听器,以获取滚动视图的当前位置/当前高度。使用此当前高度,您可以计算滚动视图底部/末端的“左空间”。如果您的RelativeLayout到达底部或接近底部在可见区域内,请调用您的动画。

amarjain07可能是您需要研究的解决方案。他将“粘性”视图指定为布局xml中的已标识属性的方法是一个很好的特性,IMHO。

amarjain07可能是您想要研究的解决方案。他将“粘性”视图指定为布局xml中标识的属性的方法是一个非常好的特性