Android NestedScrollView与RecyclerView嵌套,以及NestedScrollView不会滚动到屏幕顶部解决
①NestedScrollView与RecyclerView嵌套,导致滚动惯性消失
解决:mRecyclerView.setNestedScrollingEnabled(false);
②NestedScrollView中嵌套其他布局和RecyclerView后,不会滚动到屏幕顶部
解决给最顶部的布局View设置下requestFocus();
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:background="@android:color/white"
android:orientation="vertical"> <android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="match_parent"> <android.support.v4.widget.NestedScrollView
android:id="@+id/src"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"> <LinearLayout
android:id="@+id/ll_valuation_start"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> <ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:src="@drawable/ic_launcher_background"/> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="信用可也换钱花"
android:textColor="@android:color/black"
android:textSize="16sp"/> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="自营贷款产品,无需审核,立即放款"
android:textColor="@android:color/black"/> <android.support.v7.widget.RecyclerView android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</android.support.v7.widget.RecyclerView> </LinearLayout> </android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
如果里面ScrollView里面有连个RecyclerView则都要是设置 mRecyclerView.setNestedScrollingEnabled(false);
Android NestedScrollView与RecyclerView嵌套,以及NestedScrollView不会滚动到屏幕顶部解决的更多相关文章
- 使用NestedScrollView+ViewPager+RecyclerView+SmartRefreshLayout打造酷炫下拉视差效果并解决各种滑动冲突
使用NestedScrollView+ViewPager+RecyclerView+SmartRefreshLayout打造酷炫下拉视差效果并解决各种冲突 如果你还在为处理滑动冲突而发愁,那么你需要静 ...
- Android 使用NestedScrollView+ViewPager+RecyclerView+SmartRefreshLayout打造酷炫下拉视差效果并解决各种滑动冲突
如果你还在为处理滑动冲突而发愁,那么你需要静下心来看看这边文章,如果你能彻底理解这篇文章中使用的技术,那么,一切滑动冲突的问题解决起来就轻而易举了: 先扔一个最终实现的效果图 先分析下效果图中实现的功 ...
- Android 6.0+ RecyclerView嵌套在ScrollView中显示不全
ScrollView嵌套RecyclerView在Android6.0以下能正常显示,但是在6.0以上就会出现RecyclerView显示不全的bug.尝试多种方法之后终于找到解决办法,特在此记录下. ...
- NestedScrollView和RecyclerView使用,并设置间距
NestedScrollView和RecyclerView使用,并设置间距: 效果图如下: 1.NestedScrollView 和RecyclerView嵌套问题(类似ScrollView 和lis ...
- Android RecyclerView嵌套RecyclerView
原理 RecyclerView嵌套RecyclerView的条目,项目中可能会经常有这样的需求,但是我们将子条目设置为RecyclerView之后,却显示不出来.自己试了很久,终于找到了原因:必须先设 ...
- Android Fragment使用(二) 嵌套Fragments (Nested Fragments) 的使用及常见错误
嵌套Fragment的使用及常见错误 嵌套Fragments (Nested Fragments), 是在Fragment内部又添加Fragment. 使用时, 主要要依靠宿主Fragment的 ge ...
- RecyclerView嵌套ScrollView导致RecyclerView内容显示不全
我们在使用RecyclerView嵌套至ScrollView内的时候 RecyclerView不在屏幕内的数据会不显示出来,这里是一个坑,我们需要重写RecyclerView /** * Create ...
- Android开发:ScrollView嵌套GridView的解决办法
Android开发:ScrollView嵌套GridView的解决办法 前些日子在开发中用到了需要ScrollView嵌套GridView的情况,由于这两款控件都自带滚动条,当他们碰到一起的时候便 ...
- Android 高级编程 RecyclerView 控件的使用
RecyclerView 是Android 新添加的一个用来取代ListView的控件,它的灵活性与可替代性比listview更好. 看一下继承关系: ava.lang.Object ↳ and ...
随机推荐
- Java 实现发送邮件
javax.mail.AuthenticationFailedException: 530 Error: A secure connection is requiered(such as ssl). ...
- 【转】idea新建项目文件名为红色的解决办法
idea如果当前project用了版本控制器,其下面新建的所有的项目默认都是加入到版本控制里面,所以项目名称和文件都是红色的. 解决办法: ctrl + alt + s 进入设置界面,–>ver ...
- HTML 5 桌面提醒
<script> function showNotice(title,msg){ var Notification = window.Notification || window.mozN ...
- [BZOJ 4850][Jsoi2016]灯塔
传送门 #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<=b;++i) ...
- redis设置允许远程连接
#redis默认只允许本地访问# #根据自己的配置文件启动,linux环境下同理# #远程访问的话需要设置配置文件,在redis安装根目录下xxx.config# #修改三个地方# 地址绑定 保护模式 ...
- Training set,Gallery set 和Probe set的区别
这段时间看了CVPR2017的这篇论文”SphereFace:Deep Hypersphere Embedding for Face Recognition" 里面有提到Probe set, ...
- 1085 PAT单位排行 (25 分
每次 PAT 考试结束后,考试中心都会发布一个考生单位排行榜.本题就请你实现这个功能. 输入格式: 输入第一行给出一个正整数 N(≤),即考生人数.随后 N 行,每行按下列格式给出一个考生的信息: 准 ...
- 分享个高精度IP定位
https://www.opengps.cn/Data/IP/LocHighAcc.aspx
- PIXI AnimatedSprite 及打字爆炸动画(5)
效果 : 消除字母 当前位置出现爆炸效果 这里使用到了AnimatedSprite 动画 Members An AnimatedSprite is a simple way to display a ...
- 第十五章:集成JPUSH
如果不想自己搭建push server,则可以借助于第三方的api来实现push的功能,本文主要介绍ionic如何集成jpush. 具体步骤如下: 创建ionic应用:ionic_jpush. 申请j ...