小编arm*_*man的帖子

检查nestedscrollview中的recyclelerview滚动状态

我在NestedScrollView中使用了recyclelerview,我希望在滚动后将搜索栏固定到操作栏,并且必须在搜索栏下显示recyclelerview项目,我需要为我的recyclerview项目进行延迟加载(滚动到结束后从服务器加载下一项)为此,我需要检查recyclerview滚动更改状态,当我在nestedscrollview中使用recyclelerview时,我无法做到这一点.我尝试使用nestedscrollview滚动状态更改侦听器,它不会给我我想要的东西,也不能正常工作.

如果将嵌套滚动视图放在recyclerview中,则它不起作用.我有懒惰加载recyclelerview但相同的布局包含其他布局,如滑块,菜单然后recyclerview.我想滚动完整的布局,当recyclerview结束onscroll然后onload执行从Internet获取更多项目并加载recylerview.

在这里你看到我的代码:

我的布局xml代码

 <android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/main_activity_background">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="@color/colorPrimaryDark"
            app:expandedTitleTextAppearance="@style/TextAppearance.AppCompat.Headline"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:titleEnabled="false">

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

                <android.support.v4.view.ViewPager
                    android:id="@+id/pager"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true" />

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_centerHorizontal="true"
                    android:background="@drawable/bg_gradient"
                    android:orientation="vertical"
                    android:gravity="center_horizontal"
                    android:paddingBottom="5dp"
                    android:paddingLeft="@dimen/spacing_large"
                    android:paddingRight="@dimen/spacing_large"
                    android:paddingTop="@dimen/spacing_mxlarge">


                    <LinearLayout
                        android:id="@+id/layout_dots"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:layout_gravity="center"
                        android:gravity="center"
                        android:orientation="horizontal" />


                </RelativeLayout>

            </RelativeLayout>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            app:contentInsetStartWithNavigation="0dp"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            android:contentInsetLeft="0dp"
            android:contentInsetStart="0dp"
            app:contentInsetLeft="0dp"
            app:contentInsetStart="0dp"
            android:contentInsetRight="0dp"
            android:contentInsetEnd="0dp"
            app:contentInsetRight="0dp"
            app:contentInsetEnd="0dp">

            <LinearLayout
                android:layout_width="match_parent" …
Run Code Online (Sandbox Code Playgroud)

java android android-recyclerview android-nestedscrollview

7
推荐指数
1
解决办法
358
查看次数

如何将我的应用程序快捷方式添加到通知面板

如何将应用程序的按钮或快捷方式添加到通知面板?

我研究了它,但不幸的是没有结果。

我想要如下图所示的内容,因为您可以看到一些应用程序在其中创建了快捷方式(例如 Adm 和 Windscribe)

在此输入图像描述

android

4
推荐指数
1
解决办法
1255
查看次数