标签: swiperefreshlayout

LinearLayout上的SwipeRefreshLayout?

在一个ListView,SwipeRefreshLayout 工作正常.然而,LinearLayout仅在(没有ListView)行为是奇怪的.该SwiperefreshLayout's进度条没有完全出现,事实上,它只是出现几分之一秒.问题是什么?

android swiperefreshlayout

12
推荐指数
1
解决办法
4107
查看次数

制作自定义SwipeRefreshLayout指标?

我如何制作一个自定义指标,使用带有自定义动画的可绘制对象SwipeRefreshLayout

我查看了源代码SwipeRefreshLayout,我注意到该CircleImageView对象是私有的.

反正有没有修改ImageView

android swiperefreshlayout

12
推荐指数
1
解决办法
1万
查看次数

AppBarLayout + TabLayout + CollapsingToolbarLayout + SwipeToRefresh

我遇到了很多与我的问题有关的问题,但我发现没有人想要我正在寻找的行为.

我想要一个带有标签和应用栏的视图寻呼机,当所包含的片段可滚动并滚动(朝向底部)时,我希望应用栏消失,但是当向上滚动时,将标签留下以重新显示.其中一些片段包含SwipeToRefresh布局(有时会导致问题).我尝试了很多配置,总是会出错.

现在我没有崩溃效果(它总是隐藏)

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainPagerActivity">

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

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        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"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|enterAlways">


            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

            <android.support.design.widget.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:tabGravity="fill"
                app:tabIndicatorHeight="6dp"
                app:tabMode="fixed" />

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


    <android.support.v4.view.ViewPager
        android:id="@+id/main_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@id/app_bar_layout"
        tools:context=".MainPagerActivity"

        />

</RelativeLayout>

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:src="@android:drawable/ic_menu_edit" />
Run Code Online (Sandbox Code Playgroud)

和我的一个片段(滚动的一个):

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:wheel="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.m360learning.app.fragment.MainPagerNewsFeed">


    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipeRefreshLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <RelativeLayout …
Run Code Online (Sandbox Code Playgroud)

android swiperefreshlayout android-toolbar android-coordinatorlayout android-collapsingtoolbarlayout

12
推荐指数
1
解决办法
8103
查看次数

SwipeRefreshLayout - 向下滑动以刷新但不移动视图下拉

可能吗 ??正如标题所说

向下滑动以刷新布局,但坚持布局不要沿着滑动gusture向下移动

谢谢 - 我正在使用SwipeRefreshLayout

android android-layout swiperefreshlayout

11
推荐指数
2
解决办法
3万
查看次数

SwipeRefreshLayout隐藏在具有透明状态栏的ActionBar后面

在使用透明导航和状态栏(API级别19)时,我在查看SwipeRefreshLayout时遇到了一些问题.也就是说,它当前位于状态栏下(位于屏幕顶部),当我希望它位于操作栏下时.

ListView正在按预期工作.也就是说,内容正确显示在导航栏后面,并且不会隐藏在状态栏或操作栏下.

有了这个说,如果我将android:fitsSystemWindows ="true"属性添加到我的相对布局,SwipeRefreshLayout正常工作.但是,这样做会使我的列表视图在透明导航栏下不可见.相反,导航栏只是我背景的颜色,并且不允许在我的列表视图下显示内容.

如何使ListView保持现状,并使我的SwipeRefreshLayout可见(而不是隐藏在屏幕顶部的状态栏下)?

以下是我的布局:

<android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/drawer_layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:paddingTop="10dp"
            android:background="#ccc"
            android:clipToPadding="false">

            <android.support.v4.widget.SwipeRefreshLayout
                android:id="@+id/swipe_container"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

            <FrameLayout
                android:id="@+id/container"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:paddingRight="@dimen/activity_horizontal_margin"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="#ccc">

                <ListView
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:id="@+id/listView"
                    android:paddingTop="10dp"
                    android:fitsSystemWindows="true"
                    android:clipToPadding="false"
                    android:divider="@android:color/transparent"
                    android:layout_gravity="left|top" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:text="No Internet Connection"
                    android:id="@+id/noInternet"
                    android:textColor="@android:color/secondary_text_light"
                    android:layout_gravity="center" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:text="Pull To Refresh"
                    android:translationY="20dp"
                    android:id="@+id/nointernetSub"
                    android:textColor="@android:color/secondary_text_light"
                    android:layout_gravity="center" />

            </FrameLayout>

            </android.support.v4.widget.SwipeRefreshLayout>

        </RelativeLayout>

    <fragment android:id="@+id/navigation_drawer"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:name="com.package.app.NavigationDrawerFragment"
        tools:layout="@layout/fragment_navigation_drawer" />

</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)

android android-listview android-4.4-kitkat translucentdecor swiperefreshlayout

11
推荐指数
1
解决办法
3283
查看次数

在webview中向上滚动会导致SwipeRefreshLayout刷新

我在FrameLayout中有一个WebView,因为我正在创建一个浏览器来添加标签.FrameLayout位于SwipeRefreshLayout内.

问题:每当我在WebView中快速滚动内容时,工具栏后面会出现刷新图标.它应该只在WebView内容位于顶部时才会发生.它与FrameLayout有关,当我删除它时,问题就消失了.

布局如下所示:

<SwipeRefreshLayout
            android:id="@+id/swipeRefresh"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

        <FrameLayout
        android:id="@+id/webViewFrame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"    
        >
        <WebView
            android:id="@+id/webView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
        </FrameLayout>

</SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud)

android android-webview swiperefreshlayout android-framelayout

11
推荐指数
1
解决办法
2431
查看次数

SwipeRefreshLayout拉多次行为(SDK 23)

我有SwipeRefreshLayout这样的:

.xml:

<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swipe_refresh_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <android.support.v7.widget.RecyclerView
        android:id="@+id/haberRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud)

.java:

private SwipeRefreshLayout swipeLayout;
swipeLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.swipe_refresh_layout);
        swipeLayout.setColorSchemeColors(getResources().getColor(R.color.primary_color));
        swipeLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh() {
                refreshContent();
            }
        });
Run Code Online (Sandbox Code Playgroud)

这允许我swipeRefresh 多次拉动并且盘旋动画变得怪异,有时它会停留在屏幕上而不会盘旋:

在此输入图像描述

在第一次拉动时,它看起来有点位于顶部,在第二次拉动时它会像在图像上一样向下移动一点.

如何在刷新时禁用多次拉动SwipeRefresh?我想这不会发生在sdk 23之下.我使用的是buildTool 23,targetSdk 23,support-v4:23,appcompat-v7:23.

更新:如果我使用ListView而不是,这不会发生RecyclerView.

android swiperefreshlayout android-6.0-marshmallow

11
推荐指数
2
解决办法
2728
查看次数

SwipeRefreshLayout与ViewPager进行拦截

我在SwipeRefreshLayout中包含了一个ViewPager.有时,当我向左/向右滑动时,SRL会被触发.这主要发生在我处于片段顶部的时候.

我该如何解决这个问题?我是否需要收听某种事件才能在一定时间内禁用SRL?我还没有真正发现任何关于它的事情,所以我怀疑这是谷歌的一个实际错误,而是我实施错误的东西?有什么想法吗?

这是我的布局:

<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/mainSwipeContainer"
    android:layout_width="wrap_content"
    android:layout_height="match_parent">

    <android.support.v4.view.ViewPager
        android:id="@+id/mainViewPager"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</android.support.v4.widget.SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud)

谢谢!如果我错过了任何信息,请告诉我.

android android-viewpager swiperefreshlayout

11
推荐指数
2
解决办法
3582
查看次数

是否可以在XML中设置SwipeRefreshLayout的颜色方案?

我正在和我一起工作SwipeRefreshLayout.

我知道如何setColorScheme动态.

是否可以attribute在XML中设置SwipeRefreshLayout 的方案颜色?

java xml android swiperefreshlayout

11
推荐指数
1
解决办法
1773
查看次数

如何将array.xml中的颜色资源ID的int数组传递给SwipeRefreshLayout.setColorSchemeResources

我已经安装了Android的SwipeRefreshLayout,并尝试自定义所有拉动中的颜色以刷新整个应用程序.为了遵循DRY原则,我尝试将所需的颜色移动到array.xml,如下所示:

<resources>
    <array name="swipeRefreshColors">
        <item>@color/pink</item>
        <item>@color/green</item>
    </array>
</resources>
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试将它们导入滑动刷新时:

swipeRefreshLayout.setColorSchemeResources(R.array.swipeRefreshColors);
Run Code Online (Sandbox Code Playgroud)

我得到一个Resources $ NotFoundException:

android.content.res.Resources$NotFoundException: Resource ID #0x7f060001
            at android.content.res.Resources.getValue(Resources.java:1233)
            at android.content.res.Resources.getColor(Resources.java:887)
            at android.support.v4.widget.SwipeRefreshLayout.setColorSchemeResources(SwipeRefreshLayout.java:477)
Run Code Online (Sandbox Code Playgroud)

我已经尝试了一些东西,比如子类化SwipeRefreshLayout代码并对那里的颜色进行硬编码,但它绝对是一个黑客.必须有一种方法可以从Activity中引用一系列颜色来自定义它.

任何帮助将不胜感激!

android pull-to-refresh swiperefreshlayout

10
推荐指数
1
解决办法
3276
查看次数